-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Cart item factory OOP pattern #40128
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
base: 2.4-develop
Are you sure you want to change the base?
Conversation
Hi @adarshkhatri. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
The security team has been informed about this pull request due to the presence of risky security keywords. For security vulnerability reports, please visit Adobe's vulnerability disclosure program on HackerOne or email [email protected]. |
@magento run all tests |
@magento run all tests |
The security team has been informed about this pull request due to the presence of risky security keywords. For security vulnerability reports, please visit Adobe's vulnerability disclosure program on HackerOne or email [email protected]. |
Description (*)
I'm trying to pass additional data into the cart mutation, but currently,
CartItemFactory
is instantiated directly usingnew CartItemFactory()
. This approach prevents me from extending or customising its behaviour via subclassing or plugins.Would it be possible to refactor this so that CartItemFactory is created via a constructor or factory method? That way, we could inject dependencies or override behaviour more flexibly.
https://github.com/magento/magento2/blob/10fdaddfd21f922d0c1b4f9f889dba8cfd4be8d6/app/code/Magento/QuoteGraphQl/Model/AddProductsToCart.php#L56C33-L56
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)