Replies: 1
Hey everyone,
The issue that I am having is that I am using ajax add to cart which updates the mini cart widget (in the header) fine but doesn’t update the actual cart which I have short coded onto the page. If I refresh the page it updates the cart and the counter I have on the bottom bar but neither update when adding an item to the cart initially.
I have tried a whole heap of things to get it to update on click but all it seems to do is either remove the cart completely or causes the add to cart button to continuously loop and not add anything at all.
Im new to php and ajax and have googled and searched these forums for my answer to no avail.
I have enabled ajax in woocommerce and the code that I am using for my add to cart button on the page is:
<?php echo do_shortcode ( '[add_to_cart id="' . get_the_ID() . '" show_price="false" style="margin: 0 10px"]' ); ?>
The code I am using for the counter:
<?php echo WC()->cart->get_cart_contents_count(); ?>
Any help would be greatly appreciated as this project is due this Friday.