Skip to content

Instantly share code, notes, and snippets.

@ibndawood
Created April 30, 2020 17:12
Show Gist options
  • Select an option

  • Save ibndawood/5357b613b4f2fd0ef35c695bcb2915cf to your computer and use it in GitHub Desktop.

Select an option

Save ibndawood/5357b613b4f2fd0ef35c695bcb2915cf to your computer and use it in GitHub Desktop.
WooCommerce - Change "Add to Cart" text to "Buy Now"
// 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' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment