(function ($) { console.log("custom js"); $(document).ready(function () { // Listen for applied_coupon event $(document.body).on('applied_coupon', function () { $(document.body).trigger('wc_fragment_refresh'); }); // Listen for removed_coupon event $(document.body).on('removed_coupon', function () { $(document.body).trigger('wc_fragment_refresh'); }); jQuery(document.body).on('updated_checkout', function () { jQuery(document.body).trigger('wc_fragment_refresh'); }); // Trigger a manual refresh when coupons are applied or removed. $(document.body).on('applied_coupon removed_coupon updated_cart_totals', function () { $(document.body).trigger('wc_fragment_refresh'); }); }); })(jQuery);