How to display the add to cart button on all pages in Divi theme

by | Sep 7, 2021 | Code Snippets | 0 comments

Divi theme has 3 modules that display WooCommerce products on different pages. The shop module displays the products on any page.

The Upsells module displays the upsell products on single product pages.

And the Related products module displays the related products on single product pages.

All the 3 modules do not display the “add to cart” button. This button is important to make it easy for your customers to add more products to the cart. This should lead to more sales.

Luckily, adding the add to cart button is really simple.

Add the following code to your child theme’s functions.php file at the very end (but before ?> if the file ends with it).

add_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 9);

That’s it for today’s snippet. Let me know you want to see more like snippets this.

By Abdou

My name is Abdelfatah Aboelghit, a PHP developer from Egypt and my friends call me Abdou!
Here I write and develop products about Divi Theme.

More Article

0 Comments

Submit a Comment

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

All Access Bundle

Get ALL current & future products for $69/year instead of $327/year

Save Now →

Download The Most Powerful WordPress Theme

Pin It on Pinterest

Share This