This topic has 4 replies, 2 voices, and was last updated 5 days, 11 hours ago ago by Luca Rossi
Good afternoon friends,
Currently our online store has 2 types of products. pre-order and in-stock products.
I created 2 product templates, one for pre-order and one for in-stock. For pre-order I want to change the text button to pre-order.
While for available products the text remains the default, how do I do it? I don’t see edit text in the settings.
Dear @Ombi,
Thank you for reaching out to us.
To address your request, the solution involves creating a “Pre-order” product category and assigning the relevant products to this category. Once this is done, you can modify the “Add to Cart” button text by adding the following custom code to the functions.php file located in your XStore child theme:
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_add_to_cart_button_text_single' );
function woocommerce_add_to_cart_button_text_single() {
if ( has_term( 'pre-order', 'product_cat' ) ) {
return 'Pre-Order';
}
return __( 'Add To Cart', 'woocommerce' );
}
We hope this solution meets your requirements. Should you have any further questions or need additional assistance, please do not hesitate to contact us.
Best regards,
The 8Theme Team
its work, thank you
Glad it’s working fine.
If you need anything else please let us know.
Best regards,
The 8Theme Team
The issue related to '‘How to change the text add to cart to pre order?’' has been successfully resolved, and the topic is now closed for further responses