How To Change “Add To Cart” Button Text in DIVI Theme

If you have been looking for a way to change Add to cart button text in wooCommerce in Divi Theme, this code will let you change the text to anything you want.

To be able to change the text, follow the steps below:

  • Go to WordPress admin dashboard.
  • Then go to Appearance > Theme Editor.
  • Open functions.php file.
  • Add the code below at the bottom of the function.php file.
// To change add to cart text on single product page

add_filter( ‘woocommerce_product_single_add_to_cart_text’, ‘woocommerce_custom_single_add_to_cart_text’ );

function woocommerce_custom_single_add_to_cart_text() {

    return __( ‘Buy Now’, ‘woocommerce’ );

}

// To change add to cart text on product archives(Collection) page

add_filter( ‘woocommerce_product_add_to_cart_text’, ‘woocommerce_custom_product_add_to_cart_text’ ); 

function woocommerce_custom_product_add_to_cart_text() {

    return __( ‘Buy Now’, ‘woocommerce’ );

}

Save the changes, then check your website if the text button has changed.

Alternatively, you can use the WordPress plugin called Code Snippet to add the code.

I hope this helps.

That’s it for now. To be able to receive more of these tips. Subscribe to our YouTube channel.

2 responses to “How To Change “Add To Cart” Button Text in DIVI Theme”

  1. Mr. HR Avatar
    Mr. HR

    Working Perfect

    1. Patrick Avatar
      Patrick

      I’m glad the tutorial helped.

Leave a Reply

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

Altvise WP

WordPress plugins and practical tutorials, from the team behind Footnotes Made Easy.

Footnotes Made Easy Pro

Turn footnotes into proper academic citations. APA, MLA and Chicago styles, DOI and ISBN auto-fetch, and a reusable citation library.

Get new tutorials by email

A short email when we publish something new.

No spam. Unsubscribe at any time. By subscribing you agree to our Privacy Policy.

ChemiCloud web hosting