- This topic has 5 replies, 3 voices, and was last updated 1 year, 6 months ago by
Leo.
-
AuthorPosts
-
December 3, 2020 at 3:21 am #1565377
Jaime
I am using the below code to hide the “Out Of Stock” status from the products which are out of stock because I am showing them for pre-order.
.woocommerce div.product .out-of-stock {
display: none;
}
.woocommerce div.product p.stock {
display: none;
}
It is working good… But now I want to show the Out Of Stock on products but when removing this code, out of stock is showing on all products even on Pre-order.
All the pre-orders products are showing because I have created a particular “pre-order” tag for them. So, I want to show the out of stock status but not for the products that they pre-order tag.
So, it is possible to hide the Out Of Stock from pre-order tagged products only…
Can you customize it a bit for me? Thanks for your help!
December 3, 2020 at 5:29 am #1565540David
StaffCustomer SupportHi there,
maybe this stack overflow method would be a good solution:
https://stackoverflow.com/a/41162894
It will allow you to change the Sold Out text to something else on products with a certain tag.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/December 3, 2020 at 9:31 am #1566144Jaime
Hey, David!
It is working as I wanted… Just one more help, I want to change the Out Of Stock text to Sold Out.
Can you help with this?
Thanks
December 3, 2020 at 12:09 pm #1566324Leo
StaffCustomer SupportSomething like this might help:
https://www.wpdecoder.com/php/woocommerce-change-out-of-stock-text/These things are handled by WooCommerce so it’s kind of out of the scope of this forum.
But if you Google “change out of stock text woocommerce” then there should be lots of suggestions 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/December 4, 2020 at 10:41 am #1567682Jaime
I am using the code:
add_filter('woocommerce_get_availability', 'availability_filter_func');
function availability_filter_func($availability)
{
$availability['availability'] = str_ireplace('Out of stock', 'Sold Out', $availability['availability']);
return $availability;
}
But it is again showing for all the products, including pre-order tagged also. Can you customize it a bit so It doesn’t show on pre-order tagged products?
Thanks
December 4, 2020 at 10:51 am #1567694Leo
StaffCustomer SupportThis is a WooCommerce filter so please check with their support team first.
Found an article that might be related as well:
https://stackoverflow.com/questions/58438442/conditional-tag-for-woocommerce-pre-order-productsYou can also try a forum like this for questions that are not related to the theme:
https://wordpress.stackexchange.com/Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.