-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add cancelOrderItem mutation #5010
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: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
skipping permission checks Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
imports/plugins/core/orders/server/no-meteor/mutations/cancelOrderItem.js
Show resolved
Hide resolved
imports/plugins/core/orders/server/no-meteor/mutations/cancelOrderItem.js
Outdated
Show resolved
Hide resolved
imports/plugins/core/orders/server/no-meteor/resolvers/Mutation/cancelOrderItem.js
Outdated
Show resolved
Hide resolved
|
The mutation works and does what I had in my mind so 👍 |
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
imports/plugins/core/orders/server/no-meteor/mutations/cancelOrderItem.js
Show resolved
Hide resolved
kieckhafer
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.
Overall works as stated, one remaining question / comment but then should be good to go
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
| }; | ||
|
|
||
| // Update the subtotal since it is related to the quantity | ||
| updatedItem.subtotal = item.price.amount * cancelQuantity; |
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.
Haven't tested this in action yet, but based on fixing a similar issue when adding items to a cart, I believe that subtotal is an object with amount and currencyCode on it, not just a number.
Will confirm / disprove when testing.
Nevermind... OrderItem !== CartItem
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.
Yes, this confused me at first, too. Love these little quirks!
|
Updates resolve existing issues, and can confirm that subtotals and itemIds are updated properly when cancelling. |
Resolves #2382
Impact: minor
Type: feature
Changes
A new
cancelOrderItemmutation allows you to cancel a single order item or a partial quantity of a single order item.The operator UI does not yet use this. That will be done in a separate PR, at which time the
cancelOrderMeteor method will also be removed.cancelOrderItemcan be called internally to synchronize from an external system by settingcontext.isInternalCalltotruecancelOrderItemcan be called through GraphQL by any user with "orders" permission for the shop that owns the ordercancelOrderItemcan be called through GraphQL by the user who placed the order. In this case, the cancellation will only succeed if both the item status and the order status are "new".Breaking changes
None
Testing