dbf_calculated_fee filter hook didn’t seem to work
-
On the checkout page, I added a select box with a list of regions for user to choose from.
On change, it updates the CheckoutURL with a parameterCHECKOUTURL?location=x_region
, then in my theme’s functions.php I added the below line of code.function my_dbf_calculated_fee_callback( $calculatedFee, $kiloMeters, $divider, $price ) { $customer_location = $_GET['location'] ?? null; if($customer_location == 'x' || $customer_location == 'y') { $calculatedFee = 0; } return $calculatedFee; } add_filter( 'dbf_calculated_fee', 'my_dbf_calculated_fee_callback', 10, 4 );
To my surprise, when I choose x or y on the checkout page and it reloads the page, The distance based fee is not showing 0.
But when I echo the
$calculatedFee
above it returns 0, but the price on the checkout still remains unchanged.Am I doing something wrong?
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘dbf_calculated_fee filter hook didn’t seem to work’ is closed to new replies.