• Skip to main content
  • Skip to primary sidebar

WordPress, Genesis Framework and Storefront customization tutorials

  • Free
  • Premium
  • Membership
    • Login
  • Design
  • Blog
  • About
  • Contact
Home » Change “Add to cart” button text on specific pages in Woo

Change “Add to cart” button text on specific pages in Woo

2020-02-18 by Gabor 1 Comment

// =========================================================================
// CHANGE ADD TO CART BUTTON TEXT ON SPECIFIC PAGES
// =========================================================================
function translate_add_to_cart() {
    global $product;
    if( $product->id == 2028 ){
        return __( 'Add to basket', 'woocommerce' );
    } elseif($product->id == 2027){
        return __( 'Buy now', 'woocommerce' );
        }
    else{
        return __( 'Add to cart', 'woocommerce' );
    }
}
add_filter( 'woocommerce_product_single_add_to_cart_text', 'translate_add_to_cart', 10, 3 );

Filed Under: Free Tagged With: WooCommerce

Reader Interactions

Comments

  1. AffiliateLabz says

    2020-02-19 at 21:00

    Great content! Super high-quality! Keep it up! 🙂

    Reply

Leave a Reply Cancel reply

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

Primary Sidebar

  • Facebook
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter
  • YouTube
WP Rocket - WordPress Caching Plugin
UpdraftPlus Premium

Disclosure: Some of the links in this site are affiliate links. I will be paid a commission if you use this link to make a purchase.

  • Privacy Policy
  • Terms of Service
  • Flames Design
© 2021 WP Flames - All Right Reserved