-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
A later invocation of an OrderInterceptor-like concept #3286
Comments
Yes, I am interested. One thought though: in this new flow If that custom field check is considered heavy, I propose two options:
I think either version could land exactly where you pointed to, @michaelbromley. |
Hi @michaelbromley, I might have a related issue. Here's a high-level summary: I use resolvers to override the addition flow:
This works. I attempted a similar flow using OrderInterceptors for adjustOrderLine, but it’s not handling adjustments as expected. While both bundle-parent (triggered by the user) and bundle-children (triggered within my interceptor) hit my interceptor, only the bundle-parent gets adjusted. All my interceptors Any intuition about what might be going wrong? |
Is your feature request related to a problem? Please describe.
Currently, the
OrderInterceptor
allows implementors to run checks before order mutations are committed. However, thewillAddItemToOrder
function does not have visibility into theOrder
norOrderLine
.Describe the solution you'd like
Introduce a new function, similar to
willAddItemToOrder
, that runs at a later stage of the process, after an item has been added to the order (but not yet committed). This function should:OrderLine
with a validid
within the current context.This additional functionality would enable more complex validations and use cases by allowing checks based on the newly added
OrderLine
.Describe alternatives you've considered
We initially implemented a bundle-like concept by overriding Shop API mutations. This approach gave us access to the
Order
(viaactiveOrder
) and the bundle'sOrderLine
, allowing us to manage relationships between bundle products and their child items. However, this solution is limited to the Shop API and does not leverageOrderInterceptor
functionality.We also considered extending this approach to the Admin API by overriding draft mutations, aiming for a solution where both Shop API and Admin API would implicitly handle child items. However, after learning about
OrderInterceptor
s, we paused our implementation to explore whether they could provide an alternative.Additional context
In our current implementation of bundles:
add
,adjust
, orremove
operations).OrderInterceptor
could make our implementation more clear and maintainable.The text was updated successfully, but these errors were encountered: