Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have products with 2 variants - size and colour. I have a dropdown for each on the product page. Each variant item (e.g. "size M, Blue") has it's own stock level configured in TC.
I have got the first dropdown (size) to show the combined quantity per size (e.g. total of all size M for all colours).
What I now want to do is show the stock level in the colour dropdown, once a size has been selected. Also, I want to disable any with a stock level of zero.
So your stock is stored in the standard TC stock table?
You could also make your own controller that fetches a bunch of stocks at a time. Do that with a custom sql call to the database. That would be faster.
Yes, I assume so, it is using the built-in TC variants setup.
GetStock needs a "productidentifier" - which is easy if it's the main product, but less easy if it's a variant.
The GetStock() needs a productidentifier yes. But note that the stock in the table is linked with a SKU if you want to fetch them yourself.
The idea is that two different productidentifiers (products) with the same SKU will share their stock.
Usually the productidentifier is the node id and in the case of the buildt in variant system the variants productidentifiers is the node id and a guid.
For speed optimization I would recommend you to get all of them in one call using your own SKU's. We currently don't have a way of getting multiple stocks in one call.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted