1(function($){ 2 $(document).on('click', '.afeb-woo-atc-button', function(e){ 3 var $btn = $(this); 4 var redirect = $btn.data('redirect') || 'stay'; 5 var productId = $btn.data('product_id'); 6 var qty = parseInt($btn.closest('.afeb-woo-atc-inner').find('input.qty').val(), 10) || 1; 7 8 if (window.elementorFrontend && elementorFrontend.isEditMode()) { 9 e.preventDefault(); 10 return; 11 } 12 13 if (redirect === 'stay') { 14 return; // leave WooCommerce AJAX alone 15 } 16 17 e.preventDefault(); 18 19 // Use localized URLs instead of relying on wc_add_to_cart_params 20 var baseUrl = (redirect === 'cart') 21 ? afeb_atc_params.cart_url 22 : afeb_atc_params.checkout_url; 23 24 if (!baseUrl) { 25 console.error('Redirect URL not provided.'); 26 return; 27 } 28 29 var targetUrl = baseUrl + (baseUrl.indexOf('?') >= 0 ? '&' : '?') + 30 'add-to-cart=' + encodeURIComponent(productId) + 31 '&quantity=' + encodeURIComponent(qty); 32 33 window.location.assign(targetUrl); 34 }); 35})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.