1

The client wants related products on individual product pages.

Is it possible to have the “Commerce Products”-field allow for selection of variants rather than products as a whole? Or is there another way to achieve this functionality?

If not, I was thinking about letting the client paste the variant ids into a table field or something, then pull the variants onto the product page with ajax. Seems quite hacky though, so any alternatives are most welcome!

Thank you kindly

2

At the moment there is no Commerce variants field type unfortunately. It comes up a lot, someone should post it here: https://github.com/craftcms/commerce/issues.

Edit - I've gone ahead and posted this here - https://github.com/craftcms/commerce/issues

In the meantime yes a text or eg table field could store variant IDs...which I suppose is ultimately what a proper field type would do basically.

  • I'd say "annotated relations" would be a massive step forward in Craft land— relations that can have data attached to them, like other Element types. Not sure it would exactly help here (since the variations still wouldn't be available for selection), but the concept is similar in nature, I'd imagine? – August Miller Nov 23 '16 at 0:09
  • Well annotated relations is quite easy to achieve currently with e.g. a matrix field (or a supertable or I imagine Neo as well) - a relation plus other fields with data about that relation. We do that currently. Doesn't help here really, where you specifically need a way to target a variant element instead of a product one (a variant being a child of a product, really) – Jeremy Daalder Nov 23 '16 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.