Change "Add to cart" text strings forcefully

Mar 4th, 2021
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // To change add to cart text on single product page
  2. add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_single_add_to_cart_text' );
  3. function woocommerce_custom_single_add_to_cart_text() {
  4.     return __( 'Buy Now', 'woocommerce' );
  5. }
  7. // To change add to cart text on product archives(Collection) page
  8. add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_custom_product_add_to_cart_text' );  
  9. function woocommerce_custom_product_add_to_cart_text() {
  10.     return __( 'Buy Now', 'woocommerce' );
  11. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.