Skip to content

Instantly share code, notes, and snippets.

@OscarAbadFolgueira
Created February 27, 2016 12:23
Show Gist options
  • Save OscarAbadFolgueira/d12dde0bf7885083ef61 to your computer and use it in GitHub Desktop.
Save OscarAbadFolgueira/d12dde0bf7885083ef61 to your computer and use it in GitHub Desktop.
WordPress WooCommerce Snippet that change the text "Add to cart".
<?php
/**
* This WordPress / Woocommerce code snippet change the "Add to cart" text.
*
* Author: Oscar Abad Folgueira
* Author URI: http://www.oscarabadfolgueira.com
*
* You can copy this snippet and paste in your functions.php or you can build your own plugin
*
* Change the text for your needs.
*/
// change "Add to cart" text in category pages
add_filter( 'woocommerce_product_add_to_cart_text', 'oaf_wc_change_add_to_cart_text' );
// change "Add to cart" text in single product pages
add_filter( 'woocommerce_product_single_add_to_cart_text', 'oaf_wc_change_add_to_cart_text' );
function oaf_wc_change_add_to_cart_text() {
return __('¡Comprar Ya!', 'woocommerce');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment