Add to Cart is not updating cart or the quantity of Products
-
Hi,
I have Mystile theme in my wordpress, and I recently updated my woo-commerce plugin to 2.6.8.
So i have this code in my child theme:
1. My page is not updating the default quantities:
// Set the default quantity of all the products to zero
function custom_change_default_quantity( $args, $product ) {
if(is_page(‘shop’)){
$args[‘input_value’] = 0;
$args[‘min_value’] = 0;
}
return $args;
}
add_filter( ‘woocommerce_quantity_input_args’, ‘custom_change_default_quantity’, 100, 2 );but the quantity on page is still shows default as 1
2.Cart is not updated with the new quantities when I add to the cart, nor the quantities are updating on the page:
// Ensure cart contents update when products are added to the cart via AJAX
function woocommerce_header_add_to_cart_fragment( $fragments ) {
ob_start();
?>
cart->get_cart_url(); ?>” title=”<?php _e( ‘View your shopping cart’ ); ?>”><?php echo sprintf (_n( ‘%d item’, ‘%d items’, WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> – <?php echo WC()->cart->get_cart_total(); ?>
<?php$fragments[‘a.cart-parent’] = ob_get_clean();
return $fragments;
}
add_filter( ‘woocommerce_add_to_cart_fragments’, ‘woocommerce_header_add_to_cart_fragment’ );Kindly help as I have checked out all the forums, I cant figure out what is the issue, it was working fine before i did the theme and plugin update.
- The topic ‘Add to Cart is not updating cart or the quantity of Products’ is closed to new replies.