I found the following code in order to display text before the add-to-cart-button on a single product page:
// adds notice at single product page above add to cart
add_action( 'woocommerce_single_product_summary', 'return_policy', 20);
function return_policy() {
if ( is_single( '11675' ) ) {
echo '<p>My Text</p>';
}
}
This works perfect!
However, I would like to show this message not only on one product page (by id), but on several product pages (by serveral ids), therefore I have to insert multiple ids. How does the above code have to changed, in order to achive this? From my barely knowledge I think that one have to insert so called arrays – but unfortunately, I do not know how to code this…
2
Answers
How do you will obtain the ids of those products? If there are just a few id’s, you can just add them with an OR Statement.
This is how it looks on my test site.
if you want to use it with the help of an array then use it like this