You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Solidus Version:
v3.4.6 (should still be relevant in v4.3.2)
To Reproduce
Go to the admin backend
Go to Products > Products > [any product] > Variants
Edit any variant that has a nil shipping category
Current behavior
The selected value is the product's shipping category.
Expected behavior
The selected value should be "Use Product Shipping Category".
Screenshots
N/A
Desktop (please complete the following information):
OS: Linux
Browser: Firefox
Version: 121.0b9
Smartphone (please complete the following information):
N/A (not tested)
Additional context
After editing a variant, the inherited shipping category is saved in the variant, taking the product's value at the time of saving. From that point on, it's no longer dynamically inherited after the product's shipping category is changed.
The fix should be as simple as passing selected: @variant[:shipping_category_id] in the first options hash (ends up in the :selected option passed to options_from_collection_for_select).
Side note: the tax category select field above it should not be impacted by the same bug because Variant#tax_category_id doesn't have the same fallback.
EDIT: Fixed steps to reproduce
The text was updated successfully, but these errors were encountered:
Solidus Version:
v3.4.6 (should still be relevant in v4.3.2)
To Reproduce
Current behavior
The selected value is the product's shipping category.
Expected behavior
The selected value should be "Use Product Shipping Category".
Screenshots
N/A
Desktop (please complete the following information):
Smartphone (please complete the following information):
N/A (not tested)
Additional context
After editing a variant, the inherited shipping category is saved in the variant, taking the product's value at the time of saving. From that point on, it's no longer dynamically inherited after the product's shipping category is changed.
The bug is caused by the
collection_select
inbackend/app/views/spree/admin/variants/_form.html.erb
that gets its selected value by calling@variant.shipping_category_id
(inherited from the product if nil, instead of the actual nil value in the database).The fix should be as simple as passing
selected: @variant[:shipping_category_id]
in the first options hash (ends up in the:selected
option passed tooptions_from_collection_for_select
).Side note: the tax category select field above it should not be impacted by the same bug because
Variant#tax_category_id
doesn't have the same fallback.EDIT: Fixed steps to reproduce
The text was updated successfully, but these errors were encountered: