Injected product variation fields intermingle with product fields and there's no way to change the relative weights

Created on 14 December 2017, about 7 years ago
Updated 19 January 2024, 11 months ago

To reproduce:

- enable product variation field injection on the product type form
- at admin/commerce/config/product-variation-types/default/edit/display, set the title field to show
- create a product with 2 variations

On the product page, the order of fields is:

- Price (from the PV)
- Add to cart form (from the product)
- Title (from the PV)

Not sure what the best fix is TBH.

Two possibilities:

- Expose the fields from the PV as pseudofields on the product using hook_entity_extra_field_info(). Don't know if there would be a circularity issue there though, as we need to know the fields visible on the PV when declaring the extra fields for the P. That would allow you to intermingle them as you wish.
- Expose a single pseudofield on the product, which outputs all the fields from the PV together. Simpler, but might have theming implications as the PV fields would become 2nd-class citizens.

πŸ› Bug report
Status

Active

Version

2.0

Component

Product

Created by

πŸ‡¬πŸ‡§United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΏπŸ‡¦South Africa niki v

    It works as designed, no need for any coding or modules.

    When setting the product-type display, use "show row weights" and number accordingly. Then go to your corresponding variation display and number the variations sequentially as you would like them positioned in the product display.

    For example:
    Product display
    image - 0
    body - 1

    Product variation
    price - 2
    stock level - 3

    Product display
    add to cart form - 4
    categories - 5
    tags - 6

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica
Production build 0.71.5 2024