Skip to content

Instantly share code, notes, and snippets.

@growdev
Created October 8, 2014 14:30
Show Gist options
  • Save growdev/164f23e0f6294cb17956 to your computer and use it in GitHub Desktop.
Save growdev/164f23e0f6294cb17956 to your computer and use it in GitHub Desktop.
Change WooCommerce Add To Cart test on product page
<?php
// The Add to cart form is in this template file
// /woocommerce/templates/single-product/add-to-cart/simple.php
// and calls WC_Product::single_add_to_cart_text() to get the text for the button.
// This is the filter that is set around that text.
add_filter('woocommerce_product_single_add_to_cart_text', 'growdev_change_addtocart');
function growdev_change_addtocart( $arg ) {
// Change the argument to the new text for the button
$arg = "BUY NOW";
return $arg;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment