I would like to be able to hide the number of inventory available for my variable products. Is this possible? To just have it say "In stock" or "Out of stock"
Hiding Inventory Numbers
6 posts from 2 voices-
Posted 1 year ago #
-
Hey!
Add following code to css/custom.css or the quick css field:
.stock { display:none; }Regards,
PeterPosted 1 year ago # -
Thanks Peter for the quick response. Although this doesn't really work. It hides the stock availability entirely. Where as, for example, I have a shirt for sale on my store. And I have Mediums and Larges but no smalls. If I select small now, it does not tell me that there are none left. It lets my select and hit the "add to cart" button. But of course, nothing goes to the cart. Which would probably drive a customer nuts cause there is nothing alerting them that there are no smalls left.
Posted 1 year ago # -
Would really appreciate some help on this. Thanks.
Posted 1 year ago # -
Anything?
Posted 1 year ago # -
I haven't found a way to hide some text parts only (woocommerce is simply not flexible enough here). You can hack the core plugin files however this is quite tiring because you need to do this mod everytime a new plugin version is released. Open up woocommerce\classes\class-wc-product.php and search for:
if ($this->backorders_allowed()) : if ($this->backorders_require_notification()) : $availability = __('Available on backorder', 'woocommerce'); else : $availability = __('In stock', 'woocommerce'); endif; else : $availability = __('Out of stock', 'woocommerce'); $class = 'out-of-stock'; endif;Change the code to:
if ($this->backorders_allowed()) : if ($this->backorders_require_notification()) : $availability = __('Available on backorder', 'woocommerce'); endif; else : $class = 'out-of-stock'; endif;Posted 1 year ago #
Reply
You must log in to post.














