Search code examples
additionwoocommerce-rest-apiextrafee

Add Extra Fee on Product Page Using Hook [Woocommerce]


add_filter( 'woocommerce_get_price_html','product_page_price_display', 9999, 2 );
function product_page_price_display( $price_html, $product ) {

    $orig_price = wc_get_price_to_display( $product );
    $price_html = wc_price( $orig_price + 10 );   
    return $price_html;

}

Solution

  • add_filter( 'woocommerce_get_price_html' , 'product_page_price_display', 9999, 2 );
    function product_page_price_display( $price_html, $product ) {
    
        $orig_price = wc_get_price_to_display( $product );
        $price_html = wc_price( $orig_price + 10 );   
        return $price_html;
    
    }