Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable products #66

Open
popeating opened this issue Mar 9, 2021 · 5 comments
Open

Variable products #66

popeating opened this issue Mar 9, 2021 · 5 comments

Comments

@popeating
Copy link

It looks like complex vaiable products (for example 3 attributes with 2 options each) but with limited variations (eg one of the option from the third attributes its only available in certain condition), can't be (easily) replicated when sourcing from graphql
in this product for example (in wordpress theme)
https://shop.popland.it/prodotto/coffee-bean/
the "dark roast" option is available only for "500 gr weight" also the packaging (tin or card) depends on weight.

we can surely access all the variations with their id, price, image, attributes, but keeping track and add/remove options based on previous selection is really a pain

anyone solved it somehow?

@chriswolmarans
Copy link
Contributor

Any luck with this @popeating ? Trying to avoid having to add completely separate products to account for simple variations.

@popeating
Copy link
Author

Hi, still working on it, it looks more complex than it looks
in general i try to have full combination available (all colors available in all sizes for example), but it can happens that you can have a variation avaialable only for some other variation even in deep complexity (thinking of combination between size, color and maybe some other variation) that are not all interchangeable; and usually you dont want to split a the same product (you dont want the same tshirt in red and white on the home page, just because the red is available M and S and the white is available in M and L).
Woocommerce standard templates handle this correctly, i tried to reverse their js but jsut this part is hundreds of line!

@chriswolmarans
Copy link
Contributor

I see.. thanks @popeating sounds like a tough one indeed. Would you mind sharing the Woocommerce standard templates reference you're mentioning, would love to take a look too, definitely need to find a solution here.

@popeating
Copy link
Author

sure, it is the twentytwenty basic theme
check this page:
https://shop.popland.it/prodotto/coffee-bean/
it is using that theme and having that behaviour, not all options can be mixed

@bnbabu55
Copy link

bnbabu55 commented Sep 13, 2021

I have a Gatsby sample site I created for my client as a POC, this https://gatsbysite.devsmr-development.com/portfolio/ page where you click on a category like Financial/Business/Industrial/Consumer button and portfolio items below are filtered based on the button value. I am doing this filtering at the client side, since I have only one list, I am maintaining a portfolio array state.

In your cases, you need maintain a state variable for each of the product attribute dropdowns and run filter functions across appropriate dropdowns based on the value chosen by the user.

If you are handling handful of items then you can do it at client side, but if you want have long list of items (thousands of items) you want to filter from, then you will have to do it at the server side to get better performance. There are tutorials available to do the same, for e.g. I followed this one to get my site done, https://www.youtube.com/watch?v=Ss1NfgBhikc.

Hope this gives you some idea about the how to get this done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants