Hi im using variations and I’d like to know how to get the base product only when getting products. Also can you elaborate on the purpose of variation matrix and how to use it. I want a customer to be able to select a product (base product) then choose size and color of that product then update the price shown. Would I use variation matrix for this?
You are very much on the right track!
There is a setting called ‘list_child_products’ available in the settings service - I believe the default is true but if you set this to false then only base products are shown in product listings (see updating settings for details).
When on a product page (a base product) you can get all the information you need in the response. The variations and their options should be present in this response. You can build drop downs from this data and use the IDs of the options selected along with the variation matrix to locate the child product ID.
Here is a code pen (its old but don’t think there are many changes to how this works - it should be enough to give you an idea at the very least) - the parts you will be most interested in are the getChildID function and the on-change event handler. Have a look and a play and if you hve further questions just come back in here and we should be able to keep you right.
Hope this helps…
Thanks Ian! I did what you said and it works flawlessly
Ace - I did forget to link the code pen - moot now but for completion and if anyone else happens across this…
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.