Why is my custom WooCommerce code breaking the Ajax?

Home / Uncategorized / Why is my custom WooCommerce code breaking the Ajax?

Question:
Please could you advice me what’s wrong with my custom WooCommerce-code. I’m using it to make product quantity field for my archive pages (so that user can add multiple products to cart directly from archive – and no need to go single product -page if wants to choose more than one piece). Code of mine works great otherwise but when I active it – Ajax add to cart -system doesn’t work. What would be the problem? Here’s the code:add_filter( ‘woocommerce_loop_add_to_cart_link’, ‘quantity_inputs_for_woocommerce_loop_add_to_cart_link’, 10, 2 );
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
if ( $product && $product->is_type( ‘simple’ ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
$html = ‘

add_to_cart_url() ) . ‘" class="cart" method="post" enctype="multipart/form-data">’;
$html .= woocommerce_quantity_input( array(), $product, false );
$html .= ‘‘;
$html .= ‘

‘;
}
return $html;
}


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *