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

Saving product with variants with custom fields and auto SKU fails and clears custom fields #451

Closed
tomdeleu opened this issue Aug 19, 2018 · 1 comment
Labels

Comments

@tomdeleu
Copy link

tomdeleu commented Aug 19, 2018

Description

I have a product type setup with variants with custom fields on the variant, and with an automatic SKU format
(in my case: "{product.slug|upper}-{title|kebab|upper}")

When trying to save such a new product with more than 1 variant, saving fails due to input validation, and custom fields are cleared. SKU's are shown, and you can Immediately save again. But of course, you lose your initial custom field values. (You can fill them in again, and they are saved the second attempt.)

I made a short video to show: https://cl.ly/3P3i2z0e3A0M

Note:
When trying to save with 1 variant included, everything works. More than one fails...

Steps to reproduce

  1. Product with variants and custom fields on the variant, and automatic SKU format
  2. Add product, fill out everything and save
  3. You'll see the input validation being shown for nothing. Custom fields are cleared.

Additional info

  • Craft version: Craft Solo 3.0.20
  • PHP version: 7.1.20
  • Database driver & version: MySQL 5.7.23
@lukeholder
Copy link
Member

Thanks, this has been fixed. Issue was caused by validation error on the uniqueness of the SKU when they have not been generated yet. Your version of Commerce in the video did not show the validation error, but we now generate the SKUs before validating the product.

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

No branches or pull requests

2 participants