Updated to Commerce 3, and now when i create a node with product reference field, the dimensions and weight are missing from the product variation.

Product uses the "Inline Entity Form - Complex" widget
Product Variation uses the "commerce_product_single_variation" aka "Single variation (Product information)" widget
Weight and Dimensions use Default widget

Confusingly, the dimensions and weight show up for product variants that already existed before Commerce 3 update.

Only product variant forms for variants created after updating to Commerce 3 are missing these widgets.

Issue fork commerce-3535297

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

aaronbauman created an issue. See original summary.

aaronbauman’s picture

Issue summary: View changes
aaronbauman’s picture

OK, i traced the culprit to commerce_product_update_10301, which according to docblock :

/**
 * Moves 'variationType' setting to the 'variationTypes'.
 */

Problem was that my "variationType" was set to "default", but "variationTypes" was set to "shippable" (and shippable only).

So, after updating, "variationType" is gone, and variationTypes is "default" and "shippable" - not what i want!
And since it's a simple inline entity form, I guess it just uses the first value, which is not correct.

Not sure how this was resolved previously, but turning "default" off again solved it.

aaronbauman’s picture

Status: Active » Needs review
StatusFileSize
new962 bytes

Here's the patch I'm using.
I assume maintainers are not gonna want to roll this in, so I won't bother with an MR.
But it's working for me.

jsacksick’s picture

Status: Needs review » Needs work

hm, no this change doesn't make sense? I think what we should probably do instead is not touch the variationTypes if it is set... Can you open an MR doing this?
We only migrate the values if variationType is set but variationTypes is empty?

jsacksick’s picture

Title: Dimensions and weight missing from inline entity form after updating to Commerce 3 » The update hook for migrating the variationType setting assumes the variationTypes are not set

Retitling, working on that.

  • jsacksick committed 58f63e7a on 3.x
    Issue #3535297 by jsacksick, aaronbauman: The update hook for migrating...
jsacksick’s picture

Status: Needs work » Fixed

Went ahead and committed the amended update hook which now sets the variation type IDS only if the "variationTypes" setting is empty.

aaronbauman’s picture

Thanks, that change makes sense to me and should address my use case.

Not sure how or why variationTypes and variationType contained different values previously, but this should fix it.

Status: Fixed » Closed (fixed)

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