Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
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.
Comment | File | Size | Author |
---|---|---|---|
#4 | ability_to_use_fields-2713891-4.patch | 18.43 KB | mglaman |
#3 | ability_to_use_fields-2713891-3.patch | 11.51 KB | mglaman |
Comments
Comment #2
mglamanComment #3
mglamanHere is the initial WIP
commerce_product_variation_attributes
to attribute edit form settingcommerce_product_rendered_attribute
form elementAlmost set. For some reason edit form doesn't always want to jive. Also, the view mode is empty. Few other bugs. But posting progress.
Comment #4
mglamanPR https://github.com/drupalcommerce/commerce/pull/368
Missing test.
Comment #5
bojanz CreditAttribution: bojanz at Centarro commentedThe patch is removing a checkout commit.
Commenting on the PR for actual code stuff.
Comment #7
bojanz CreditAttribution: bojanz at Centarro commentedMerged!