Apply and Remove Coupon AJAX on Checkout Page Not Working
-
I am using WooCommerce Version 3.4.5.
I noticed that the AJAX calls for the apply coupon and remove coupon on my checkout page are not working 100%. The AJAX calls are being called correctly but they fail to update the review order table with the discounts and order totals.
I decided to investigate the woocommerce/assets/js/frontend/checkout.js file. I enabled WooCommerce to use this file instead of the min.js version by editing this line in class-wc-frontend-scripts.php.
'wc-checkout' => array( 'src' => self::get_asset_url( 'assets/js/frontend/checkout.js' ),
This allowed me to edit the code in checkout.js to debug.
I discovered that the wc_checkout_coupons object has two functions, submit and remove_coupon that do not seem to be able to get the if(code) condition to run after a successful AJAX call.
If I comment out the if(code) condition, the checkout page apply and remove coupon features work perfectly.
Therefore, my question is. Why is the if(code) condition not working? Any idea what I can do to fix this issue without editing checkout.js?
- The topic ‘Apply and Remove Coupon AJAX on Checkout Page Not Working’ is closed to new replies.