Skip Navigation

[Resuelto] How i can displaying "sold out" when the stock is 0

This support ticket is created hace 6 años. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Este tema contiene 2 respuestas, tiene 3 mensajes.

Última actualización por ernestasK hace 6 años.

Asistido por: Waqar.

Autor
Mensajes
#1145279

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

#1145575

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

#1920915

It does not work for variable products. It displays 1 in both cases 🙁