Created
February 19, 2019 15:52
-
-
Save plugin-republic/462975544b9c76c9fc8f503c8722334f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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); |
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
Hi, thanks for sharing this. I went through your article, and got it working, which is awesome.
But it seems it will result in a page reload when trying to update the notes after removing one or more items from the cart.
Do you have some time to take a look into this? Thanks again.