Skip to content

Instantly share code, notes, and snippets.

@ofernandolopes
Created May 6, 2020 15:41
Show Gist options
  • Save ofernandolopes/e68c1988b9d1af62b39462c057a93945 to your computer and use it in GitHub Desktop.
Save ofernandolopes/e68c1988b9d1af62b39462c057a93945 to your computer and use it in GitHub Desktop.
WooCommerce - Change add to cart text
// 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