woocommerce product showing two “Add to Cart” butt

2019-09-02 21:24发布

问题:

I am using woocommerce plugin, It is showing products details on desktop view is correct but when i switch on mobile view or tablet(i.e. responsive) view then it shows two "Add to Cart" button for one product.

回答1:

Single product is displayed from wp-content\plugins\woocommerce\templates\single-product.php

This file (wp-content\plugins\woocommerce\templates\content-single-product.php) is called from single-product.php for adding content and add-to-cart button on single product page.



回答2:

If someone is struggeling with this, add this code to wordpress > wp-content > plugins > woocommerce.php in function WC() right before return WooCommerce::inherit();

remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );

this will remove the button.