Skip to content

Instantly share code, notes, and snippets.

@webbouwer
Last active April 30, 2021 17:33
Show Gist options
  • Save webbouwer/148fd0ee5494b40d9db4e81098f161df to your computer and use it in GitHub Desktop.
Save webbouwer/148fd0ee5494b40d9db4e81098f161df to your computer and use it in GitHub Desktop.
Change add to cart text (functions.php) for Wordpress Woocommerce/Divi
<?php
/* Common used php (functions.php) for Wordpress Divi / Woocommerce Theme */
// Woo cart & button adjustments
// 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 __( 'Add to bag', '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 __( 'Add to bag', 'woocommerce' );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment