-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Conversation
Signed-off-by: Sujith <mail.sujithvn@gmail.com>
|
@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)]; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
This PR is replaced by the commit |
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 theupdateShopSettings
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
updateShopSettings
mutation to update the default ff-types for shop.updateShopSettings
mutation to remove any of the default ff-types for shop.