Skip to content

Instantly share code, notes, and snippets.

@jorpdesigns
Last active September 20, 2021 13:11
Show Gist options
  • Save jorpdesigns/4c2653e92dc445355faeb8a4fe77cf38 to your computer and use it in GitHub Desktop.
Save jorpdesigns/4c2653e92dc445355faeb8a4fe77cf38 to your computer and use it in GitHub Desktop.
Snippet to change "Add to Cart" button text on WooCommerce archive and single product pages
<?php
// ARCHIVE
add_filter('woocommerce_product_add_to_cart_text', 'custom_archive_cart_button_text');
function custom_archive_cart_button_text() {
return __('Purchase', 'woocommerce');
}
// SINGLE PAGE
add_filter('woocommerce_product_single_add_to_cart_text', 'custom_single_cart_button_text');
function custom_single_cart_button_text() {
return __('Add to Basket', 'woocommerce');
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment