I am looking for a function to change the Add to Cart text on a woocommerce button but only if the product in question has a specific tag. ie if the product has the tag “preorder” the button text changes to “Pre Order Now”
Changing the text globally can be achieved with this;
http://docs.woothemes.com/document/change-add-to-cart-button-text/
Thanks.
You can check for that particular term with
has_term
.Let me know the output.
It’s been a while, but try something along the following lines:
Basically what you’re trying to do is do a conditional where you check if the product tag is “preorder”. I am not sure if this exact code would work if there are multiple tags.
Edit:
You might have to use this filter to change it on the product page
Add this into your child theme function.php file
You can fix it by adding a few lines of codes in
functions.php
:http://visupporti.com/woocommerce-how-to-change-add-to-cart-text/