Cart Refresh Disabling Functions.php
-
After a few hours we have narrowed down our issue to the FDP
We have this code in our functions.php that quite simply takes $350 off all package rates if the cart is over 4500. However, with FDP enabled – you will notice that the $350 deduction is visible on first load of the Checkout Page, but the cart contents will be refreshed by another ajax call and reset to their original state, removing the $350 discount.
I have enabled all plugins on the checkout page
I have disabled all plugins on the checkout page
I have toggled off the checkout page
Does not workThe only thing that works is disabling FDP altogether. Code is below
// [DO NOT ENQUE] $350 Discount on Shipping if Cart is Over 4500 [Shipping Pages Only] function apply_shipping_discount( $rates ) { if ( ! is_checkout() ) { return $rates; } $cart_total = WC()->cart->get_subtotal(); if ( $cart_total > 4500 ) { $discount_amount = 350; foreach( $rates as $key => $rate ) { $rates[$key]->cost = $rates[$key]->cost - $discount_amount; } } return $rates; } add_filter( 'woocommerce_package_rates', 'apply_shipping_discount' );The page I need help with: [log in to see the link]
The topic ‘Cart Refresh Disabling Functions.php’ is closed to new replies.