We have another great question from Isaac Phillips! You’re working on a Magento 2 project with a custom GraphQL-based frontend. During the checkout process, it's necessary to have some additional logic that happens when the qty changes or updates are made on the cart page. A plugin was added on Quote::save for that purpose, but, during testing, you notice that the plugin also runs during the shipping and payment steps, causing unintended side effects. What’s the best way to ensure the plugin doesn't get triggered on those additional steps? ℹ Comment with your answer and reasoning. #swiftotter #magento #magentodeveloper #adobecommerce #weeklypracticequestion
A is the right choice
A is the Correct answer.
A
I think it is A.
A
Option A is the correct answer. On a custom GraphQL-based frontend, you only need to review the relevant GraphQL modules. You can implement a beforeResolve plugin in the etc/graphql/di.xml file to accomplish this. Additionally, you can extend UpdateCartItemsInput to include an extra argument, such as step. By passing this parameter from the frontend, you can check it within your plugin class and make the necessary modifications accordingly. ❤️
A is the correct answer
A - Class contain update cart items methods
Technical Lead, 3X M2 Certified Developer, Magento 1 Certified Developer(1X)
5moA is the answer! Why not C? Because in GraphQL there is no url pattern to match in any model/resolver. Why not B? It's extra work to check for each and every possible data changes like, add/update item, dlete item, update shipping/billing address change, shipping method change etc. So A should be the proper way to achieve this.