0

Currently add to cart form can be modified from the "manage form display" of the line item. But this place shows all the attributes as a single entry.

Where is the best place to modify the sorting of attributes, inject other elements to the form between attributes etc?

For example I want to show an image field (from product) just before "add to cart" button. Should I use form_alter or is there a twig file that I can readily use?

1

I realise this answer may be a little late, but for those that end up here looking for a way to display the product variation fields (price, add to cart buttons, etc) separately, you can do it through the commerce-product.html.twig template using something like this:

<article{{ attributes }}>
  {{ product.title }}
  {{ product.body }}
  {{ product.variation_price }}
  {{ product.variations }} //show add to cart button
</article>

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.