-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Product defaultPrice is incorrect (uses wrong variant) #830
Comments
Thanks, fixed for the next release. |
Thanks Luke For anyone wanting to know how to work around this until the release: In your module use the namespace:
In your module init method (where SomeModule and someService are the respective names of your module and service):
Then in your service use the namespace:
And add the methods:
EDIT: Restored the insert event as it actually IS needed |
Within the beforeSave method of the elements/Product.php (Line 882)
$defaultVariant variable never gets set to non NULL resulting in the last variant returned by getVariants() becoming the default variant.
Solution is to either change $defaultVariant to $this->_defaultVariant
or
$this->_defaultVariant = $defaultVariant = $variant;
Using Craft - 3.1.22 with Commerce - 2.1.3.1
Issue exists in latest version at time of this message.
The text was updated successfully, but these errors were encountered: