Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themepaint/ae34578f29869f5a63bbe929ff02f0f3 to your computer and use it in GitHub Desktop.
Save themepaint/ae34578f29869f5a63bbe929ff02f0f3 to your computer and use it in GitHub Desktop.
Woocommerce product type detection and cart text change
add_filter( 'woocommerce_product_single_add_to_cart_text', 'custom_single_add_to_cart_text' );
function custom_single_add_to_cart_text() {
global $product;
if( $product->is_type( 'variable' ) ){
return __( 'HD Download', 'woocommerce' );
}else{
return __( 'Add to Cart', 'woocommerce' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment