0

I have a View Pane on my home page where I list all products that are in promotion. Each product variation that can be set to "show in promo banner 1" via a taxonomy term field with checkboxes. So the store owner can now tick this checkbox to indicate that this product variation is in promotion. This works but only for product displays that have only 1 variation. When, for example, I only tick this checkbox for "product variation 4" of a particular product and no other variations, the first variation shows with a variation select widget and that's not what I want. So how can I only show that particular variation without the widget but with all the correct data and an add to cart button?

1
  • Can you update the question with info about your Views config and Taxonomy on variations?
    – prkos
    Sep 14, 2019 at 11:01

1 Answer 1

1

If what you're seeing is the fully rendered Add to Cart form in your View, then what you're looking to do is impossible without custom code. The Add to Cart form is rendered via the field display formatter on your product display node type. It has no way to interact with the configuration or results of a Views query.

You can create a View just showing variations with an Add to Cart button that doesn't invoke the entire form, but doing so will strip the creating line item of the context of what product display that variation is a part of. This means the line item won't link to the product page like it ordinarily would. You could always link it yourself if you know that each variation only exists on one node via a reverse reference, but you'd likely still lose some functionality related to the standard form's normal grouping of variations.

If that's an acceptable trade-off, then you need to recreate your View using Commerce Product entities as the base as opposed to Nodes. Otherwise you're going to have to create some custom Views plugins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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