By default, Woocommerce ajax add to cart functionality is only supposed to apply to simple products on archive, shop, category pages, etc.. But for some reason it is also adding variable products to the cart when I click "Select Options." Select Options is supposed to go to the product page. How can I disable ajax add to cart on variable products?
By default, Woocommerce ajax add to cart functionality is only supposed to apply to simple products on archive, shop, category pages, etc.. But for some reason it is also adding variable products to the cart when I click "Select Options." Select Options is supposed to go to the product page. How can I disable ajax add to cart on variable products?
Share Improve this question asked Jan 28, 2016 at 9:24 j8dj8d 2552 silver badges13 bronze badges1 Answer
Reset to default 0Here's the fix...
Change the line in \inc\woocommerce\template-tags-categories.php which reads:
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button ajax_add_to_cart' : '',
to:
$product->is_purchasable() && $product->is_in_stock() && $product->is_type( 'simple' ) ? 'add_to_cart_button ajax_add_to_cart' : '',