1

I have a new site with Drupal 9 and Commerce 2. I am trying to display my products with:

  • Title
  • Photo
  • Price
  • Delay
  • Options
  • Add to cart button
  • Description

I tested all the possible settings in manage display, but nothing works. What I get is inconsistent with the configuration.

How do I organize the display of product variation fields?

screenshot

screenshot

screenshot

1

This is a known difficulty in Commerce 2.x. You can review the options in this issue https://www.drupal.org/project/commerce/issues/2928139

The best solution I have found is clicking show row weights in manage display for the product, the product variation, and the order item type - add to cart form - form display. You can then manually set the weights rather than drag and drop. For example set the weight of the field you want to be first to -50, and the field you want to be last to be 50. Then adjust the fields in the middle.

You will have to jump back and forth between the 3 displays I mentioned, and this won't fix all your problems, but it will help.

You can overwrite the twig template in your theme as seen here: https://www.drupal.org/project/commerce/issues/2928139#comment-13444854

You could also hack and hide all the fields, and build custom view of fields, and use display suite to add the block view to your product display.

It really depends on what exactly you want to do.

4
  • Thanks, but I don't understand what to do with the weight of the fields
    – steevee666
    Jun 10 at 1:28
  • Click show row weights and set the weights manually. See the issue I shared. Jun 10 at 1:30
  • I edited the answer with better details. Jun 10 at 2:14
  • The only problem with using Views is that the price doesn't update when you select the product attribute options. Unless I am doing something wrong...
    – hockey2112
    Jun 10 at 16:33

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.