Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Created February 19, 2019 15:52
Show Gist options
  • Save plugin-republic/462975544b9c76c9fc8f503c8722334f to your computer and use it in GitHub Desktop.
Save plugin-republic/462975544b9c76c9fc8f503c8722334f to your computer and use it in GitHub Desktop.
(function($){
$(document).ready(function(){
$('.prefix-cart-notes').on('change keyup paste',function(){
$('.cart_totals').block({
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
});
var cart_id = $(this).data('cart-id');
$.ajax(
{
type: 'POST',
url: prefix_vars.ajaxurl,
data: {
action: 'prefix_update_cart_notes',
security: $('#woocommerce-cart-nonce').val(),
notes: $('#cart_notes_' + cart_id).val(),
cart_id: cart_id
},
success: function( response ) {
$('.cart_totals').unblock();
}
}
)
});
});
})(jQuery);
@shahidbahader
Copy link

This event is not firing after we hit the update cart. when the cart page is loaded initially, everything works fine, but when we change the quantity of the item and hit the Update Cart button, the cart is updated. after that, the text changes are not saved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment