-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: shipping method restrictions #4821
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
Merged
aldeed
merged 171 commits into
release-2.0.0-rc.8
from
feat-kieckhafer-shippingRestrictions
Dec 11, 2018
Merged
feat: shipping method restrictions #4821
aldeed
merged 171 commits into
release-2.0.0-rc.8
from
feat-kieckhafer-shippingRestrictions
Dec 11, 2018
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…s for a fulfillment group
… items in the cart
…ction into feat-shipping-rules
…ction into feat-shipping-rules
…eckhafer-shippingRestrictions
Member
Author
|
@aldeed Round two of comments addressed, good for a look. Thanks! |
This was referenced Dec 6, 2018
aldeed
requested changes
Dec 10, 2018
Contributor
aldeed
left a comment
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.
@kieckhafer Just a couple minor straggler comments. Seems about ready.
imports/plugins/core/cart/server/no-meteor/util/xformCartGroupToCommonOrder.js
Show resolved
Hide resolved
imports/plugins/core/orders/server/no-meteor/mutations/createOrder.js
Outdated
Show resolved
Hide resolved
imports/plugins/included/shipping-rates/server/no-meteor/util/isShippingRestricted.js
Outdated
Show resolved
Hide resolved
aldeed
approved these changes
Dec 10, 2018
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Impact: major
Type: feature
Issue
Shops should be able to restrict available shipping methods based on shipping location and attributes of items inside an order (price, brand, type of item, etc).
Solution
Create both universal and per-method ways to allow or deny a shipping method based on the address attached to the an order, and attributes attached to items in an order. This is done by creating a FlatRateFulfillmentMethodRestrictions collection, and creating allow and deny restrictions for each method inside this collection.
Breaking changes
None. These are add-on features. If no Allow or Deny restrictions are found on a method, the method will be allowed in the same way it currently is. If no surcharges are found, nothing is different.
Testing
FlatRateFulfillmentRestrictionsdatabase, that includes various restrictions.Use the dumps with the following commands:
mongorestore --db reaction --collection Shipping Shipping.bsonmongorestore --db reaction --collection FlatRateFulfillmentRestrictions FlatRateFulfillmentRestrictions.bsonReactionto see a universal restrictionThis video shows using a California address (contiguous 48 states), a Hawaii address, an Alaska address, and a New York Address, combined with the vendor being

Reaction, which creates a universal restriction:Examples that are built in to the data in the mongo dump:
Destination restrictions go down to a zip code level. Try changing the
newYorkReactionVendorrestriction to the following to only restrict certain postal codes, instead of all of New York State:This is easiest to test in the existing app, as you can add multiple addresses and easily switch between them to see the options change, but this will also work on the starterkit, with a little more effort to change the location when checking out.
There are also new GraphQL queries / mutations to
add,delete,update, andgetrestrictions from the database.