WooCommerce with WooTheme Ajax Fragments Conflict
-
I’ve been making a custom cart widget for WooCommerce – it’s working perfectly with non woothemes but with woothemes, if they have their own cart hard coded in to the theme, then my widget stops automatically updating with ajax.
The code that woocommerce uses to update by ajax in their themes is:
add_filter('add_to_cart_fragments', 'woocommerce_cart_link'); function woocommerce_cart_link() { global $woocommerce; ob_start(); ?> <a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> <?php _e('in your shopping cart', 'woothemes'); ?>" class="cart-button "> <span class="label"><?php _e('My Basket:', 'woothemes'); ?></span> <?php echo $woocommerce->cart->get_cart_total(); ?> <span class="items"><?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count); ?></span> </a> <?php $fragments['a.cart-button'] = ob_get_clean(); return $fragments; }
I am using similar code in my custom cart in two places, for updating things – even though I use the code twice, it works fine, but when the code is used in a wootheme, the ajax stops working – I’m assuming it’s some kind of conflict, but my functions are named differently so I can’t see where a conflict may be.
Any help is much appreciated.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘WooCommerce with WooTheme Ajax Fragments Conflict’ is closed to new replies.