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 2 Question 42 Discussion

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

Lizette
4 days ago
Option A with an observer sounds a bit hacky to me. I'd rather go with a dedicated tax collector in a custom module.
upvoted 0 times
...
Kindra
6 days ago
I like the idea of using a before plugin in option B. It allows for more control over the tax calculation process.
upvoted 0 times
...
Shay
17 days ago
I think declaring a new total collector in etc/sales.xml in a custom module is the best approach for adding taxes to all orders.
upvoted 0 times
...
Evelynn
22 days ago
I disagree, I believe the Architect should write a before plugin to \Magento\Quote\Model\QuoteManagement::placeOrder() and add the custom tax to the quote.
upvoted 0 times
...
Mindy
27 days ago
Option C seems the most straightforward. Declaring a new total collector in a custom module is the way to go for complex tax calculations.
upvoted 0 times
Delila
15 days ago
A: It definitely seems like the most efficient way to add the custom tax to all orders in Adobe Commerce.
upvoted 0 times
...
Edda
18 days ago
B: I agree, declaring a new total collector in a custom module seems like the most straightforward approach.
upvoted 0 times
...
Kanisha
21 days ago
A: I think option C is the best choice for handling complex tax calculations.
upvoted 0 times
...
...
Shelba
1 months ago
I think the Architect should add a new observer to the event sales.quote.collect.totals.before and add the custom tax to the quote.
upvoted 0 times
...

Save Cancel