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

feat: support passing product data with createProduct and createProductVariant #6150

Merged
merged 8 commits into from
Apr 1, 2020

Conversation

aldeed
Copy link
Contributor

@aldeed aldeed commented Mar 15, 2020

Resolves #6103
Type: feature

Changes

  • Add optional ProductInput to createProduct mutation
  • Add a createProduct mutation param to allow skipping auto-creation of the first variant
  • Add optional ProductVariantInput to createProductVariant mutation

Breaking changes

None

Testing

  1. Pass product param to createProduct mutation with all available fields set, and verify that they have correct values in the response and the database.
  2. Pass variant param to createProductVariant mutation with all available fields set, and verify that they have correct values in the response and the database.
  3. Ensure that updateProduct and updateProductVariant mutations still work correctly for updating the same fields.
  4. Pass shouldCreateFirstVariant: false when calling the createProduct mutation, and verify that the variants array is empty in the response, and that no variant was created in the database.

@aldeed aldeed changed the title feat: add more createProduct fields feat: support passing product data with createProduct and createProductVariant Mar 15, 2020
to createProduct mutation

Signed-off-by: Eric Dobbertin <[email protected]>
@aldeed aldeed marked this pull request as ready for review March 17, 2020 20:52
@aldeed aldeed requested a review from mikemurray March 17, 2020 20:52
@aldeed aldeed self-assigned this Mar 17, 2020
Copy link
Member

@mikemurray mikemurray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aldeed I can create variants with a price but not compareAtPrice. I thought prices should be set through updateVariantPrices mutation rather than through the main variant mutations. Not sure if we should remove the prices field, add compareAtPrice, or just leave it as is.

Otherwise, things seem to work fine.

@brent-hoover
Copy link
Collaborator

@aldeed I think we should allow (optional) passing of _id when creating a product via the API. This would allow import processes that want to use a natural key to specify this. If not specified then it could use the typical random string.

@aldeed
Copy link
Contributor Author

aldeed commented Mar 29, 2020

@zenweasel Added setting _id on creation for products and variants

@mikemurray This is an existing issue so I cannot remove price without it being a breaking change to the updateProductVariant mutation. Instead, I added compareAtPrice to keep it consistent, but marked both of those fields as deprecated with instructions to use updateProductVariantPrices instead.

@manueldelreal This should be ready for final testing now.

on input fields

Signed-off-by: Eric Dobbertin <[email protected]>
Copy link
Member

@manueldelreal manueldelreal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@aldeed aldeed merged commit 0097dee into trunk Apr 1, 2020
@aldeed aldeed deleted the feat-aldeed-6103-simpler-product-create branch April 1, 2020 13:02
@kieckhafer kieckhafer mentioned this pull request Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CreateProductInput & CreateProductVariantInput needs product data support
4 participants