In Commerce 1.x we had to use Commerce Fancy Attributes and Field Extractor to render attributes as a different kind of value beyond its label/title. Such as showing a color swatch instead of just a color name.

Now that we have commerce_product_attribute_value entity, we can implement this in the core module.

Proposed resolution

Add an option on the Edit form to select what field to use for the add to cart form. Render that fields based on the display mode settings for the bundle.

Remaining tasks

Write the patch.

The way to configure the display of the field seems rough on UX. But that can be improved in time in a follow up.

Members fund testing for the Drupal project. Drupal Association Learn more


mglaman created an issue. See original summary.

mglaman’s picture

Assigned: Unassigned » mglaman
mglaman’s picture

Status: Active » Needs work
11.51 KB

Here is the initial WIP

  • Move Radio/Select config from commerce_product_variation_attributes to attribute edit form setting
  • Add commerce_product_rendered_attribute form element
  • Rendered attribute is option for add to cart form setting, new display mode that will render

Almost set. For some reason edit form doesn't always want to jive. Also, the view mode is empty. Few other bugs. But posting progress.

mglaman’s picture

Status: Needs work » Needs review
18.43 KB
bojanz’s picture

Status: Needs review » Needs work

The patch is removing a checkout commit.

Commenting on the PR for actual code stuff.

  • mglaman committed 1b3bdb7 on 8.x-2.x
    Issue #2713891 by mglaman: Ability to use fields on an...
  • bojanz committed 6d65acb on 8.x-2.x
    Merge pull request #368 from mglaman/2713891-fancy-attributes
    Issue #...
bojanz’s picture

Status: Needs work » Fixed


Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.