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 AD0-E722 Exam - Topic 3 Question 57 Discussion

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?
C) Declare a new total collector in 'etc/sales.xmr in a custom module
A) Add a new observer to the event sales.quote.collecLtotals.before'' and add the custom tax to the quote
B) Write a before plugin to \Magento\Quote\Model\QuoteManagement::placeOrder() and add the custom tax to the quote

Adobe AD0-E722 Exam - Topic 3 Question 57 Discussion

Actual exam question for Adobe's AD0-E722 exam
Question #: 57
Topic #: 3
[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:

0/2000 characters
Shonda
4 days ago
Option B seems risky. Plugins can complicate things too much.
upvoted 0 times
...
Cecily
9 days ago
I prefer option C. It’s cleaner to declare a new total collector.
upvoted 0 times
...
Franchesca
14 days ago
I think option A is the best. Observers are flexible.
upvoted 0 times
...
Evangelina
20 days ago
I've used option A before, it worked well for me in similar situations.
upvoted 0 times
...
Viki
25 days ago
Wait, can a custom module really handle all that complexity? Sounds risky!
upvoted 0 times
...
Kris
30 days ago
Option B could lead to issues with other plugins, not a fan.
upvoted 0 times
...
Lezlie
1 month ago
I disagree, A seems more straightforward for handling quotes.
upvoted 0 times
...
Stephen
1 month ago
I think option C is the best way to go. Custom modules are the way to handle complex taxes.
upvoted 0 times
...
Hyman
2 months ago
I vaguely remember that using observers might not be the most efficient way for this scenario, especially with complex tax rules.
upvoted 0 times
...
Winfred
2 months ago
I feel like writing a before plugin could be a good way to ensure the tax is applied right before the order is placed, but I’m not entirely confident.
upvoted 0 times
...
Gail
2 months ago
I think option C sounds familiar; we practiced declaring total collectors in our last session, but I can't recall the exact steps.
upvoted 0 times
...
Samira
2 months ago
I remember we discussed using observers in class, but I'm not sure if that's the best approach for complex tax calculations.
upvoted 0 times
...

Save Cancel