Created
October 16, 2023 06:36
-
-
Save ahmedeshaan/9f99204695b20ce2218ae17509d92629 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_product_add_to_cart_text', 'custom_loop_add_to_cart_button', 20, 2 ); | |
add_filter( 'woocommerce_product_single_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(10357339); // product id | |
if( in_array($product->get_id(), $specific_ids) ) { | |
$button_text = __("Subscribe now!", "woocommerce"); | |
} | |
return $button_text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment