Add a custom class to variation options displaying "Out Of Stock" in Woocommerce

Asked
Active3 hr before
Viewed126 times

5 Answers

classcustom
90%

I'm using "How to add variation stock status to Woocommerce product variation dropdown" answer code to show the text "In Stock" or "Out of stock" according to the stock status of the variation., Meta Stack Overflow ,I need to add a custom class only to these variants that showing text "Out of Stock"., Stack Overflow Public questions & answers

0
88%

I'm using "How to add variation stock status to Woocommerce product variation dropdown" answer code to show the text "In Stock" or "Out of stock" according to the stock status of the variation.,For my Woocommerce variable products I'm implementing a custom size chooser on the single product page and have this sizes in a table: These variations are jus...,Ever since we upgraded to Woocommerce version 3 our order confirmations are showing huge titles that include the variation detail. I don't like how it looks and...,I need to add a custom class only to these variants that showing text "Out of Stock".

0
72%

In the Attributes section, add attributes before creating variations — use global attributes that are site-wide or define custom ones specific to a product.,Add Attributes to Use for Variations,Inventory for variable products can be managed on product and variation level. ,Variable products in WooCommerce let you offer a set of variations on a product, with control over prices, stock, image and more for each variation. They can be used for a product like a shirt, where you can offer a large, medium and small and in different colors.

65%

👉 Show Cross Sign For Out of Stock Variation Swatches (Up To 30 Variations),👉 Hide For Out of Stock Variation Swatches (Up To 30 Variations),👉 Blur For Out of Stock Variation Swatches (Up To 30 Variations),👉 Show Cross Sign For Out of Stock Variation Swatches (Unlimited Variations Without hiding out of stock item from catalog)

load more v
75%

I can pull out the stock level for the overall product, but now for each variation.,Ok, first you'll need to get product variations like this: ,Outside the variations loop you need to add the wording for in-stock and out-of-stock variations,I would like to show the stock status (eg. In Stock / Out of Stock) for each product variation shown in the drop down list of variations on the Woocommerce Product Page. I have copied the relevant function to my theme's functions.php file, and can edit the content, but am unsure how to pull out the required stock status for each variation.

load more v

Other "class-custom" queries related to "Add a custom class to variation options displaying "Out Of Stock" in Woocommerce"