Very new to Drupal and Commerce 2.x. I'm use to working with WooCommerce on Wordpress.

I have a list of equipment products and product attributes created. Each equipment category has different specification so I created different product variation type so I can add in the different attributes.

Under product types > manage display, the variation format is set to "add to cart form".

My question is how do I style the variation so that it displays as a table? display:table and display:flex doesn't seem to work with the fieldgroups.

Here is what it looks like now:

Here's how it currently looks like

I want the above information to look like this:

enter image description here

Eventually I will be changing out the add to cart button to a request a quote so I wasn't sure if i needed to keep the variation format as an add to cart form or not. Unless there is a way for me to add the button in the template itself?


What you're needing really is a general overview of Drupal 8 theming using Twig. The parts you're asking about theming here are just Drupal fields like any other, and you can format / render them into the page's HTML however you'd like from the appropriate template file. What that file is called and how you'll reference the fields you've added is dependent on your theme and the names you've set for those fields.

The "Add to Cart form" display formatter doesn't control the inclusion of these fields. It's solely used to render the actual Add to Cart form. The rest of the variation fields are injected into the product display from whatever the currently selected variation on the Add to Cart form is.

|improve this answer|||||

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.