Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save encoderit-arman/b2e095f531aa6b1a1a00e38e48030499 to your computer and use it in GitHub Desktop.
Save encoderit-arman/b2e095f531aa6b1a1a00e38e48030499 to your computer and use it in GitHub Desktop.
add_filter( 'woocommerce_product_add_to_cart_text', 'custom_loop_add_to_cart_button', 20, 2 );
function custom_loop_add_to_cart_button( $button_text, $product ) {
// HERE define your specific product IDs in this array
$specific_ids = array(37, 40, 53);
if( in_array($product->get_id(), $specific_ids) ) {
$button_text = __("add to cart", "woocommerce");
} else {
$button_text = __('+', 'woocommerce');
}
return $button_text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment