Joseph Maxwell’s Post

View profile for Joseph Maxwell

Founder & CMO @ SwiftOtter, Inc. | eCommerce (Adobe Commerce, BigCommerce and Shopify) Expert

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

  • graphical user interface, text, application
Chirag Pamnani

Technical Lead, 3X M2 Certified Developer, Magento 1 Certified Developer(1X)

5mo

A 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.

𝐌𝐨𝐡𝐢𝐭 𝐃𝐡𝐚𝐧𝐯𝐚𝐧𝐢

Linkedin Top Voice | Sr. software engineer | Magento 2 Developer | Hyva | Laravel | React | GraphQl

5mo

A is the right choice

Kuntal Dalal

Consultant at Infosys || Adobe Commerce Certified Master || Adobe Commerce Certified Expert || Adobe Certified Professional || Adobe Business Practitioner Professional || Senior Magento 2 Certified Developer

5mo

A is the Correct answer.

Wilson Sheldon

Principal Software Architect/Engineer

5mo

A

Oscar Rolando Gamboa Acho 🇧🇴

4x Adobe Certified Developer & Backend Developer

5mo

I think it is A.

Khimesh Purohit

Magento (Adobe Commerce) | PHP | Laravel | Symfony | Javascript | Node js | Python | Odoo

5mo

A

Vijay Rami

Open to Exciting Opportunities in E-Commerce Development | Magento 2X Certified (Frontend & Backend) | Expertise in PWA, GraphQL & React

5mo

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. ❤️

Santosh Kumar Patel

Adobe Certified Master Architect – Magento Commerce | Adobe Certified Expert | Ex-KPMG | Ex-Nagarro

5mo

A is the correct answer

Haris Tariq

Software Engineer | Certified Adobe Commerce | Certified Celigo | Integration Expert

5mo

A - Class contain update cart items methods

See more comments

To view or add a comment, sign in

Explore topics