What does the code you currently have look like?
You would have to check there in the function in which context it is called. If you only execute the new product template for certain products, you could check this in the following way:
add_action( 'woocommerce_single_product_summary', 'promo_alert', 20 );
function promo_alert() {
$post = get_queried_object();
$product = wc_get_product($post->ID);
if( in_array($product->get_id(), [42]) ) {
return;
}
echo '<strong>WORLDWIDE SHIPPING rates... ...notifications.</i><hr>';
}
In the example, the product with ID 42 is excluded from displaying the hint.
Unfortunately I don’t know how you assign the template to the products. If necessary, you can also use this as a criterion by accessing the product object.
Seems like you are on the right track and thank you for the prompt replies. Cant get it to run yet as:
Parse error: syntax error, unexpected token “&”, expecting “)” in C:\Users… …functions.php
-
This reply was modified 1 year, 2 months ago by cshinkin.
Oops take that back error was because I copied your script from the email rather than here. That works. Thank you so much its very much appreciated here.
Glad if I could help. When you’ve finished implementing it, feel free to set the topic to solved.
Thank you once again sir could never have worked that out in that way myself. I am learning though 🙂
-
This reply was modified 1 year, 2 months ago by cshinkin.