selected_variation also need to be set when Product has only one variation

Created on 27 May 2022, over 2 years ago
Updated 25 July 2024, 5 months ago

selected_variation also need to be set when Product has only one variation

The BUG appears here:
\Drupal\commerce_product\Plugin\Field\FieldWidget\ProductVariationAttributesWidget::formElement

when Product has only one variation, also need:
$form_state->set('selected_variation', $selected_variation->id());
Otherwise, the following method will have problems:
\Drupal\commerce_product\Plugin\Field\FieldWidget\ProductVariationWidgetBase::ajaxRefresh

This is necessary when selling custom product with a refresh price

๐Ÿ› Bug report
Status

Fixed

Version

2.30

Component

Product

Created by

๐Ÿ‡จ๐Ÿ‡ณChina yunke

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.

Production build 0.71.5 2024