Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Adobe Exam AD0-E722 Topic 7 Question 45 Discussion

Actual exam question for Adobe's AD0-E722 exam
Question #: 45
Topic #: 7
[All AD0-E722 Questions]

A company wants to build an Adobe Commerce website to sell their products to customers in their country. The taxes in their country are highly complex and require customization to Adobe Commerce. An Architect is trying to solve this problem by creating a custom tax calculator that will handle the calculation of taxes for all orders in Adobe Commerce.

Following best practices, how should the Architect add the taxes for all orders?

Show Suggested Answer Hide Answer
Suggested Answer: C

According to the Adobe Commerce documentation, the best way to add a custom tax calculation to all orders is to declare a new total collector in the ''etc/sales.xml'' file of a custom module. This way, the custom tax logic can be implemented in a separate class that extends the MagentoQuoteModelQuoteAddressTotalAbstractTotal class and overrides the collect() and fetch() methods. The collect() method is responsible for calculating the tax amount and adding it to the quote address, while the fetch() method is responsible for displaying the tax amount in the cart and checkout pages. The new total collector can be assigned to any area of the order totals, such as before or after the subtotal, shipping, or grand total.


Customizing order totals

How to add custom fee or discount to order totals in Magento 2

Contribute your Thoughts:

Salley
2 days ago
I feel like declaring a new total collector in option C could be the most appropriate method, especially for complex tax scenarios.
upvoted 0 times
...
Tamala
8 days ago
I think option B sounds familiar; we practiced using plugins to modify core functionality, but I wonder if that's the right place for tax calculations.
upvoted 0 times
...
Antonio
13 days ago
I remember discussing the observer pattern in class, but I'm not entirely sure if using an observer is the best approach for tax calculations.
upvoted 0 times
...
Alonso
18 days ago
I'm leaning towards option C - declaring a new total collector in the sales.xml file. That seems like it would be the most robust and maintainable way to handle the custom tax calculation. It's probably the best way to ensure the tax is properly applied to all orders.
upvoted 0 times
...
Cory
23 days ago
Option B looks interesting, using a before plugin on the QuoteManagement::placeOrder() method. That could work, but I'm not sure if that's the most efficient way to handle the tax calculation. I'd want to double-check that it's the recommended approach for this type of requirement.
upvoted 0 times
...
Gerardo
28 days ago
Hmm, I'm a bit unsure about this one. I'm not super familiar with the different ways to add custom tax calculations in Adobe Commerce. I think I'd need to review the documentation on the available extension points and best practices before deciding on the right approach.
upvoted 0 times
...
Candida
1 month ago
This seems like a pretty straightforward question. I'd go with option A - adding a new observer to the "sales.quote.collect_totals.before" event and then adding the custom tax to the quote. That way, the tax calculation will happen before the order is placed.
upvoted 0 times
...

Save Cancel