Skip Navigation

[Résolu] Out of stock badge dont show up

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I would like to include a badge on each product list item that is out of stock.

Solution: Use the WooCommerce Views calculated fields to determine stock status. Use conditional HTML output to apply your badge.

Relevant Documentation:
https://toolset.com/documentation/woocommerce-views-calculated-fields-and-batch-update/

This support ticket is created Il y a 6 années et 12 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Marqué : ,

This topic contains 2 réponses, has 2 voix.

Last updated by marc-andre Il y a 6 années et 12 mois.

Assisted by: Christian Cox.

Auteur
Publications
#508452

on this site : hidden link

look at the woocommerce loop, it show all the product in order, and it's fine...
but when you look at the single product page : hidden link
it SHOW the VENDU (sold in english) badge, and IT PERFECT

what i need it's the badge to show up in the loop listing
that it !

#508662
outofstock-fields.png

Hi, I'll help you get this badge showing correctly. Here are the steps to take:

1. Edit your product. In the section 'WooCommerce Views filter fields' set the 'Product in stock status' value to 'outofstock'. (see outofstock.png)
2. Edit the loop that shows your products. Each item should be wrapped in a div with a class that will be 'outofstock' when the product is out of stock.

<div class="[types field='views_woo_in_stock'][/types]">
...current loop item output goes here
</div>

Step 2 might need to be adjusted a bit depending on your theme, but I can assist with that if this doesn't make sense. If you need more help with that, please take a screenshot of the Loop Output editor for the View that shows your vehicles. I'll be able to provide better code examples for you this way.

#508749

It work, but it's akward to have to "tell" it at two different places, in stock and in WooCommerce Views filter fields. If you can explain this, it will be nice, otherwise, i will tell the customer to DOUBLE outofstock each product and the en it's a plaster but hey ! it work ! thanks

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.