Plugin do WooCommerce para estimativa de frete na página do produto.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

37 lines
1015 B

(function( $ ) {
'use strict';
$(function() {
$('#shipping_estimate_form input[name="postcode"]').mask('#####-###');
$( document.body ).on( 'submit', '#shipping_estimate_form', function(event) {
event.preventDefault();
var submit_button = $(this).find('button[type="submit"]');
$(submit_button).addClass('loading')
var product_id = $(this).find('input[name="product_id"]').val();
var quantity = $(this).find('input[name="quantity"]').val();
var postcode = $(this).find('input[name="postcode"]').val();
$.ajax({
type: 'GET',
url: wc_ajax_url, // eslint-disable-line
data: {
'wc-ajax': 'shipping_estimate_postcode',
'postcode': postcode,
'product_id': product_id,
'quantity': quantity,
},
success: function( response ) {
$('#shipping_estimate_response').replaceWith(response);
$(submit_button).removeClass('loading');
},
error: function() {
$(submit_button).removeClass('loading');
},
});
});
});
})( jQuery );