Skip Navigation

[Resolved] Unable to display stock quantity

This thread is resolved. Here is a description of the problem and solution.

Problem:

In this ticket the customer wanted to display in his view the woocommerce stock quantity of his products.

Solution:
Since the _stock field is not a field created in types then you will need to use our [wpv-post-field] shortcode.

[wpv-post-field name='_stock']

This should display your stock information.

This support ticket is created 6 years, 8 months ago. 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.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 3 replies, has 3 voices.

Last updated by Lee 6 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#627225
stock.JPG

I am trying to: display a list of product showing stock as one of their item field

I expected to see: stock quantity in number

My cred form works fine perfectly, this is my cred from where the stock is successfully add and can be edited
[cred_field field='_stock' post='product' value='' urlparam='' class='form-control' output='bootstrap']

But in my view, i cant find the stock, so i use this
<td>[types field='_stock'][/types]</td>

But i will not display anything as depict in the attachment.

Kindly assist

#627309

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jack,

Thank you for contacting our support forum.

Since the _stock field is not a field created in types then you will need to use our [wpv-post-field] shortcode.

[wpv-post-field name='_stock']

This should display your stock information.

Thanks,
Shane

#627353

Hi, thank you.

This have been solved

#1084561

Lee

Hi, I would like to use the [wpv-post-field name='_stock'] field in a conditional output, so...

If stock level is 0 display A
If stock level is <10 display B
If stock level is >10 display C

So as an example I have tried:

[wpv-conditional if="( $(wpv-post-field name='_stock') eq '0' )"] A [/wpv-conditional]

Thanks
James