Skip to content

Instantly share code, notes, and snippets.

@ofernandolopes
Forked from ChromeOrange/functions.php
Last active August 29, 2015 14:21
Show Gist options
  • Save ofernandolopes/7334f7b9f142482864ba to your computer and use it in GitHub Desktop.
Save ofernandolopes/7334f7b9f142482864ba to your computer and use it in GitHub Desktop.
WooCommerce - Replace all add to cart button text
<?php
// Single Product
add_filter( 'single_add_to_cart_text', 'custom_single_add_to_cart_text' );
function custom_single_add_to_cart_text() {
return 'Add to cart'; // Change this to change the text on the Single Product Add to cart button.
}
// Variable Product
add_filter( 'variable_add_to_cart_text', 'custom_variable_add_to_cart_text' );
function custom_variable_add_to_cart_text() {
return 'Select options'; // Change this to change the text on the Variable Product button.
}
// Grouped Product
add_filter( 'grouped_add_to_cart_text', 'custom_grouped_add_to_cart_text' );
function custom_grouped_add_to_cart_text() {
return 'View options'; // Change this to change the text on the Grouped Product button.
}
// External Product
add_filter( 'external_add_to_cart_text', 'custom_external_add_to_cart_text' );
function custom_external_add_to_cart_text() {
return 'Read More'; // Change this to change the text on the External Product button.
}
// Default
add_filter( 'add_to_cart_text', 'custom_add_to_cart_text' );
function custom_add_to_cart_text() {
return 'Add to cart'; // Change this to change the text on the Default button.
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment