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?
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.