Ask your WordPress questions! Pay money and get answers fast! (more info)

woocommerce_package_rates

  • REFUNDED

I have code snippet on Functions.php , Currently I am using the following:

function flat_rates_cost2( $rates, $package ) {
global $woocommerce;

$rates['flat_rate']->cost = 1;
return $rates;

}
add_filter( 'woocommerce_package_rates', 'flat_rates_cost2', 10, 2 );


I would like to be able to use the snippet code directly on the product page, instead of Functions.php

The code above doesn't work on product page.

Can anyone help?

Answers (2)

2016-09-15

Reigel Gallarde answers:

there's no rates on product page by default, so that would not work...
it will depend on how you are displaying (if that's the case) the rate on the product page.

2016-09-15

Bob answers:

you mean you want to show flat rate price on single product page. correct?