+
Skip to content

Set default ff-type for shop to be used in CreateProduct #6543

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

Closed
wants to merge 3 commits into from

Conversation

sujithvn
Copy link
Contributor

@sujithvn sujithvn commented Oct 4, 2022

Signed-off-by: Sujith mail.sujithvn@gmail.com

Resolves #6474
Impact: major
Type: feature

Issue

Admin should be able to define what available fulfillment types should be added by default to new products(#6474)
User should be able to check a box in the admin on any/all/none of the fulfillment types and those would automatically be added to new products as they are created. THIS SHOULD NOT AFFECT EXISTING PRODUCTS AT ALL

Solution

Current available FF-types can be retrieved using the query getFulfillmentTypes and presented to user. User can select one/all/none of the ff-types and use the updateShopSettings mutation to update the same.

While creating a new Product, the supportedFulfillmentTypes in the input (if provided) will be added to the default ff-types from the shop settings and used for creating new product.

Breaking changes

None. If there are no ff-types added then no entries are added to product. User input will be retained as it is.

Testing

  1. use the updateShopSettings mutation to update the default ff-types for shop.
  2. new products created will include the default ff-type from shop settings
  3. use the updateShopSettings mutation to remove any of the default ff-types for shop.
  4. new products created will contain only user input ff-types

Signed-off-by: Sujith <mail.sujithvn@gmail.com>
@changeset-bot
Copy link

changeset-bot bot commented Oct 4, 2022

⚠️ No Changeset found

Latest commit: b918041

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sujithvn sujithvn changed the title feat: set default ff-type for shop Set default ff-type for shop to be used in CreateProduct Oct 4, 2022
@brent-hoover
Copy link
Collaborator

@sujithvn Please correct your branches on this and other PR's

let combinedSupportedFulfillmentTypes = [];
if (defaultFulfillmentTypesForShop) combinedSupportedFulfillmentTypes = [...defaultFulfillmentTypesForShop];
if (supportedFulfillmentTypes) combinedSupportedFulfillmentTypes = [...combinedSupportedFulfillmentTypes, ...supportedFulfillmentTypes];
combinedSupportedFulfillmentTypes = [...new Set(combinedSupportedFulfillmentTypes)];
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems wrong. If a product has supportedFulfillmentTypes supplied when creating it, wouldn't you want to keep that as is? I would think it would just be:

supportedFulfillmentTypes: initialProductData.supportedFulfillmentTypes || defaultFulfillmentTypesForShop || []

If the intention is to force every produce to support these, then another prefix like base or global might be a better name than default for the setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aldeed
Yes, my intention was to add the user provided supportedFulfillmentTypes to the base entries defined for the Shop. But either of them could be undefined. That is the reason I did so.
As you mentioned, base would be a better name than default in the shopSettings.

},
"defaultFulfillmentTypesForShop.$": {
type: String,
optional: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional on the item schema would mean a sparse array (with nulls allowed) so "defaultFulfillmentTypesForShop.$": String is probably better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, removing the optional

Signed-off-by: Sujith <mail.sujithvn@gmail.com>
Signed-off-by: Sujith <mail.sujithvn@gmail.com>
@brent-hoover brent-hoover removed the request for review from tedraykov January 6, 2023 00:02
@sujithvn
Copy link
Contributor Author

This PR is replaced by the commit df5ed5e2f8ef9509490c2e90af20f9b80f439773 on branch 00-fulfillment-base

@sujithvn sujithvn closed this May 18, 2023
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.

4 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载