Skip to content
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

Cannot duplicate products after update to 3.2.8 #1783

Closed
amphibian opened this issue Oct 14, 2020 · 1 comment
Closed

Cannot duplicate products after update to 3.2.8 #1783

amphibian opened this issue Oct 14, 2020 · 1 comment

Comments

@amphibian
Copy link

When attempting to duplicate a product via Save as a new product, an exception is thrown, though the exception is also bugged.

Argument 3 passed to yii\web\ServerErrorHttpException::__construct() must be an instance of Exception or null, instance of Error given, called in /<path>/craftcms/vendor/craftcms/commerce/src/controllers/ProductsController.php on line 264

The line in question:

in /<path>/craftcms/vendor/craftcms/commerce/src/controllers/ProductsController.php at line 263 – yii\web\ServerErrorHttpException::__construct('An error occurred when duplicati...', 0, Error)

If I go in and die with that error (rather than throwing the exception), I find the source of the issue:

Call to a member function getSkuAsText() on null

This appears to be happening in src/elements/Product.php here:

$record->defaultSku = $this->getDefaultVariant()->getSkuAsText();

I have confirmed that all products have default variants set, and I have tried resaving them as well just to be sure.

  • Craft version: 3.15.12.1
  • Commerce version: 3.2.8
  • PHP version: 7.3.23
@nfourtythree
Copy link
Contributor

Hi @amphibian

Thank you for bringing this to our attention.

We have just pushed a patch release of Commerce that fixes this issue.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants