Add Extra Fee on Product Page Using Hook [Woocommerce]

103 Views Asked by At
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;

}
1

There are 1 best solutions below

1
On BEST ANSWER
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;

}