PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.6
ShopBuilder – WooCommerce Builder For Elementor v3.2.6
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / assets / js / modules / shared / coupon.js

coupon.js in ShopBuilder – WooCommerce Builder For Elementor 3.2.6, at assets/js/modules/shared/coupon.js

1 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (()=>{"use strict";var o,e,n=function(o){var e=o("body");!e.find(".rtsb-shopify-order-summery").length>0&&!e.find(".elementor-widget-container").length>0||(e.off("click.rtsbApplyCoupon"),e.on("click.rtsbApplyCoupon",'button[name="apply_coupon"]',function(e){e.preventDefault();var n=[],t=null,r=!1,c=!1,i=!1;if(o(this).parents(".rtsb-shopify-order-summery").length>0?(t=o(this).parents(".rtsb-shopify-order-summery"),r=!0,i=!0):o("body").find(".woocommerce-form-coupon").length>0?(t=o(this).parents(".woocommerce-form-coupon"),r=!0):o("body").find(".rtsb-cart-table").length>0&&(t=o(this).parents(".rtsb-cart-table, .rtsb-coupon-wrapper"),c=!0,n.push(o(".rtsb-cart-totals"))),t){n.push(t),n.forEach(function(o){o.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})});var a=t.find('input[name="coupon_code"]').val(),u=null;if("undefined"!=typeof wc_checkout_params?u=wc_checkout_params:"undefined"!=typeof wc_cart_params&&(u=wc_cart_params),u){var p={security:u.apply_coupon_nonce,coupon_code:a};o.ajax({type:"POST",url:u.wc_ajax_url.toString().replace("%%endpoint%%","apply_coupon"),data:new URLSearchParams(p).toString(),success:function(e){e&&(o(".woocommerce-error, .woocommerce-message").remove(),r?requestAnimationFrame(function(){window.displayNotice(e),i?o(document.body).trigger("applied_coupon_in_checkout",[a]):t.slideUp(),o(document.body).trigger("update_checkout",{update_shipping_method:!0})}):c&&(o(document).trigger("wc_update_cart"),setTimeout(function(){requestAnimationFrame(function(){window.displayNotice(e)})},700)),requestAnimationFrame(function(){n.forEach(function(o){o.removeClass("processing").unblock()})}))},error:function(o){console.log(o),console.log("Error applying coupon.")}})}}}))};o=jQuery,window.RTSB&&window.RTSB._initialized&&(null===(e=window.RTSB.modules.register("applyCoupon",function(){return{name:"applyCoupon",version:"1.0.0",init:function(){return n(o),this},refresh:function(){n(o)}}}))||void 0===e||e.init())})();