最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

woocommerce offtopic - Variable Products Being Added to Cart with AJAX on Shop and Category Pages

programmeradmin11浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 0

Here'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' : '',

发布评论

评论列表(0)

  1. 暂无评论