ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 1 - AD0-E722 discussion

Report
Export

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?

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

Explanation:

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 \Magento\Quote\Model\Quote\Address\Total\AbstractTotal 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

asked 02/10/2024
Renante Elpa
23 questions
NextNext
User
Your answer:
0 comments
Sorted by

Leave a comment first