Creating orders from the Magento 2 admin panel is one of the most commonly feature store admins use. As developers, there is a high need to customize or extend this functionality to meet specific business needs.
When building custom features, there’s a frequent need to update specific sections of the order creation page — such as totals, taxes, discounts, or shipping costs without refreshing the entire page.
Refreshing the entire page generally causes the below issues:
- Adds unnecessary server load
- Disrupts the admin’s workflow
- Reduces the performance and user experience
That’s why reloading only the affected block is the best and recommended practice.
A dynamic reload totals on admin create order page in Magento 2 using JavaScript is needed in below cases:
- The totals are recalculated
- Shipping and tax rules are correctly applied
- Discounts or custom changes reflect accurately
- Refreshing totals display
- Update any related UI elements
How to Dynamically Reload Totals on Admin Create Order Page in Magento 2 Using JavaScript?
Integrate the below solution in your js file to reload the total block on the admin create page.
window.order.loadArea(['specify_total_block_name', 'totals'], true);
Where window.order refers to a global JavaScript object provided by Magento’s admin UI (specifically in order creation/edit views).
Simply, use this solution to ensure data accuracy, better performance, and a smoother admin experience.
Reloading only the necessary sections like totals using JavaScript is always a smart approach when working with the admin order page in Magento 2.