i want to change out of stock product button text currently its showing read more instead of this i want change it to Out Of Stock So how can i change it please help me through
This topic has 5 replies, 3 voices, and was last updated 2 months, 2 weeks ago ago by Andrew Mitchell
i want to change out of stock product button text currently its showing read more instead of this i want change it to Out Of Stock So how can i change it please help me through
Hi @Fantasy,
Please try adding this custom code under functions.php file locates in your child theme:
add_filter( 'woocommerce_product_add_to_cart_text', 'bbloomer_archive_custom_cart_button_text' );
function bbloomer_archive_custom_cart_button_text( $text ) {
global $product;
if ( $product && ! $product->is_in_stock() ) {
return 'Out of stock';
}
return $text;
}
an also want to change out of stock button color
Add this custom CSS code under XStore > Theme Options > Theme Custom CSS > Global CSS:
.outofstock .etheme-product-grid-content a.button.product_type_simple.etheme-product-grid-button {
background-color: red;
}
Hope it helps!
add_filter Not working can you do it from my side please
Dear @Fantasy,
We hope this message finds you well.
We wanted to inform you that the custom code has been successfully implemented, and the button text has been updated as per your request.
Should you have any further questions or require additional assistance, please don’t hesitate to reach out.
Best regards,
The 8Theme Team
Dear Fantasy,
As we continue our mission to exceed expectations, your insights become increasingly valuable. Could we, with all due respect, request your thoughtful feedback by giving our theme a deserved 5-star rating on ThemeForest?
Click here to share your valuable perspective: https://themeforest.net/downloads
Your time and trust are highly appreciated!
Best Regards,
The 8Theme Team
The issue related to '‘change out of stock button’' has been successfully resolved, and the topic is now closed for further responses