Hello,
By default i have this field
[wpv-woo-buy-or-select add_to_cart_text='Add to cart' link_to_product_text='' group_add_to_cart_text='' external_add_to_cart_text='' show_quantity_in_button='no' show_variation_options='no']
but when the stock is 0 i want displaying "sold out"
How i can do this ?
Thx
Hi Thierry,
Thank you for contacting us and I'll be happy to assist.
To check whether a product is available in stock or not, you can use Toolset View's built-in field "views_woo_in_stock" in conditions like this:
( ref: https://toolset.com/documentation/user-guides/woocommerce-views-calculated-fields-and-batch-update/ )
[wpv-conditional if="( $(views_woo_in_stock) eq '1' )"]
[wpv-woo-buy-or-select add_to_cart_text='Add to cart' link_to_product_text='' group_add_to_cart_text='' external_add_to_cart_text='' show_quantity_in_button='no' show_variation_options='no']
[/wpv-conditional]
[wpv-conditional if="( $(views_woo_in_stock) ne '1' )"]
sold out
[/wpv-conditional]
As a result, the "sold out" text will show when the stock quantity is 0 and the add to cart button will show when that count it is available in stock.
I hope this helps.
regards,
Waqar
It does not work for variable products. It displays 1 in both cases 🙁