Custom Plugin not Triggering Side Cart Properly
-
I built a custom sizing plugin for a client and had things working well before they decided to use your plugin. While I can get it triggered to open, it won’t show any new items added to the cart. For example, the following two code blocks deal with adding a sample to the cart:
function order_sample_button() { if(!is_product()) { return; } ?> <button type="button" id="order-sample" class="xoo-wsc-cart-trigger"> Order $5 Sample </button> <?php }$.ajax({ type: 'POST', url: wc_params_custom.ajax_url, data: ORDER, success: (response) => { console.log('response: ', response) }, error: (error) => { console.log('error: ', error); }, });The
ajaxlives inside an event listener waiting for a click on the order button. I can get the side cart to pop out by using the class on the button, but nothing gets added to the cart until the page gets refreshed. I’m at a loss to figure out why these two plugins aren’t working together so well.Any thoughts? Thanks in advance!
Note: the two
console.logstatements simply log out ‘added to cart’ or ‘not added to cart.’ I consistently see ‘added to cart’ in the console every time, just nothing showing in the side cart.
The topic ‘Custom Plugin not Triggering Side Cart Properly’ is closed to new replies.