Skip to content

Instantly share code, notes, and snippets.

@woogists
Last active December 6, 2023 09:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woogists/c36ed76c10d187262ed150590d4dffe7 to your computer and use it in GitHub Desktop.
Save woogists/c36ed76c10d187262ed150590d4dffe7 to your computer and use it in GitHub Desktop.
Change the 'Add to Cart' button text on either single product or archives pages.
<?php
// Change add to cart text on single product page
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_add_to_cart_button_text_single' );
function woocommerce_add_to_cart_button_text_single() {
return __( 'Add to Cart Button Text', 'woocommerce' );
}
// Change add to cart text on product archives page
add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_add_to_cart_button_text_archives' );
function woocommerce_add_to_cart_button_text_archives() {
return __( 'Add to Cart Button Text', 'woocommerce' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment