Skip to content

Instantly share code, notes, and snippets.

@elitteral
Created February 26, 2015 04:01
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save elitteral/a655d4b078d34ad23006 to your computer and use it in GitHub Desktop.
Save elitteral/a655d4b078d34ad23006 to your computer and use it in GitHub Desktop.
Cause Divi to show the Add To Cart buttons on the Shop page when using the WooCommerce plugin
/*
* Divi WordPress Theme and WooCommerce plugin
* Make the Add To Cart buttons appear on the WooCommerce shop page.
*/
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 20 );
@alexanderbiscajin
Copy link

Some of the store owners find difficulty while removing the add to cart buttons. For any shop page you can remove add to cart button through adding following hooks to woocommerce.php (located wp-content/plugins/woocommerce)
function WpBlog() {
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');
return WooCommerce::instance();
}
After refreshing you can see that the button has been removed from the page. If you still see that the button hasn't been removed then you can view this as reference https://www.wpblog.com/add-to-cart-button-in-woocommerce-store/

@gonzalo-novak
Copy link

You are my hero <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment