Can item inventory totals be accessed from a Category listing.

VinnyQPVinnyQP Posts: 1Member
First timer... thank you  in advance for any support or guidance you may provide.

There appears to be certain RAIN product variables that can't be accessed on every page?  

My current example - Say I have a category that displays four products and one of them is out-of-stock and I merely wish to check the stock level of an item and if less than say '1'; I would like the word 'out of stock' to appear where we see the 'new' and 'sale' tags now. (note this has nothing to do with backorder options)

I have done some testing using a demo account and got the general idea to work but has hard as I try i can't get the current inventory total for each item to appear as part of each product listing when viewing a category. 

This is making it impossible to check the stock levels of the items when they are displayed as part of a category with a twig 'for/ else' statement.  

Other product variables from the listing of RAIN product variables display as expected by not when i try to read the product variable ... product.stock.level

Using the simple code below I am able to display the current inventory level for a selected item, however this only seems to work on the Product details page - but does not appear on the Category gird listing of products when editing .... snippets/products.rain. 

I can get the product.title and product.id etc but not others such as product.stock.level. 

{% set stockdrx = product.stock.level %} current stock= {{ stockdrx }}

Is this some kind of bug and or known limitation?  


Answers

  • sspindsspind Posts: 6Member
    edited April 12

    Same issue .. any advice?

  • JoeyJoey Posts: 152Administrator, Moderator, Lightspeed Staff moderator

    This is a known limitation, the collection pages (like the category page) only know about the Default variant.

    The developer toolbar will show the available variables for the page you are on. Enable it by searching tb/show in the frontend searchbar.

    eCom Support Team
    Lightspeed HQ
Sign In or Register to comment.