Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Not working with [add_to_cart] shortcode

$
0
0

Replies: 0

Hi,

I noticed that after the updates 4 days ago that the plugin now no longer works for the [add_to_cart] shortcode.

Having a quick look through the code I am assuming this might be because the form that is generated from the shortcode doesn’t have any input for the quantity, and in the ajax-add-to-cart JS file there is now some commented out code that looks like it was forcing a single item as the quantity, but now that it is commented out it means this shortcode doesn’t work.

On another note, I have noticed that the ajax updating of the cart fragments (number of items in the cart) has also stopped working.

I am using a function to make this happen, and it was working with your plugin previously, but now it has stopped working.

add_filter( 'woocommerce_add_to_cart_fragments', 'iconic_cart_count_fragments', 10, 1 );
function iconic_cart_count_fragments( $fragments ) {
 $fragments['#nav div.cart-contents .basket-number'] = '<span class="basket-number">' . WC()->cart->get_cart_contents_count() . '</span>';
 return $fragments;
}

Any thoughts on this? and as to why the plugin wouldn’t now be working with the [add-to_cart] shortcode?

Thanks!


Viewing all articles
Browse latest Browse all 59525

Trending Articles