简体   繁体   中英

Woocommerce update cart in categories

I have problem in a custom WooCommerce Theme i am working with. I know HTML and CSS very well but i am bit of a newbie when it comes to PHP and javascript. I have managed to solve everything except this one problem; in the product page when i press add to cart the page reloads and displays a message that says "Your product has been added to the cart". But when i add a product to the cart in any of the category pages the page doesnt reload and the quantity in the cart doesnt increase until i manually reload the page.

I have looked around for an answer to this but cant seem to find the right solution. Is there any way to get the same function in the category page as in the product page?

My code for the cart is:

 <div id="cartContent"> <?php if (class_exists('woocommerce')) :?> <?php global $woocommerce; ?> <span class="cartRow"><?php echo sprintf(_n('Products: %d', 'Products: %d', $woocommerce->cart->cart_contents_count, 'ecogray'), $woocommerce->cart->cart_contents_count);?> </span> <span class="cartRow">Sum: <?php echo $woocommerce->cart->get_cart_total(); ?></span> <?php endif; ?> </div> 

I think you should untick selection in woocommerce setting: Woocommer \\Setting\\ untick Add to cart with AJAX. I have similiar problem, after item added, page is not reload. But untick this selection page will auto reload after add or even remove.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM