How To

How to Move Apply Coupon to Order Summary in Magento 2

Hello Magento Friends 👋,

Hope you are going well with your Magento 2 stores. Today’s subject matter is How to Move Apply Coupon to Order Summary in Magento 2. Check our earlier published blog in case you missed out. Magento 2: How to add WYSIWYG Editor in Admin Configuration.

Preface:

Magento 2 provides a default design for the cart page and checkout page. Many a time,  requirements arise to move some fields to another field instead of the default design. The apply discount code is displayed after the shopping cart items list in default Magento 2. Look at the below image:

The chances are customers may miss out to look at the apply coupon code section as it is displayed at the bottom. The order summary is the area where the customers definitely look up to before proceeding for checkout. Moving apply coupon code to order summary is an ideal solution to grab customers’ attention.

Let’s start 🚀

How to Move Apply Coupon to Order Summary in Magento 2?

Step 1: Move to the below path:

app\code\Vendor\Extension\view\frontend\layout\checkout_cart_index.xml

Now, add the below code:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.cart.coupon" remove="true"/>
        <block class="Magento\Checkout\Block\Cart\Coupon" name="checkout.cart.showcouponbefortotal" as="coupon" template="Magento_Checkout::cart/coupon.phtml"/>
        <move element="checkout.cart.showcouponbefortotal" destination="cart.summary" before="checkout.cart.totals.container"/>
    </body>
</page>

Step 2: Now, clean the cache and check the output.

Output:

Conclusion:

Simple as that. This way you can Move Apply Coupon to Order Summary in Magento 2. Display a dropdown list of multiple coupons and manage it easily with the help of Easy Coupon Manager Extension for Magento 2. In case you find any issue while executing the code, mention in the comment part and I will be right back to you. Ensure you share the article with your friends and colleagues. Stay connected for more such Magento solutions.

Happy Coding 😊

Click to rate this post!
[Total: 8 Average: 5]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate 🎖️ Certified Magento Developer👨‍💻. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.🏏

View Comments

Recent Posts

Magento 2: Add Quantity Increment and Decrement on Category Page

Hello Magento Friends, In this blog, we will discuss about adding quantity increment and decrement…

21 hours ago

How to Integrate ChatGPT with Laravel Application?

In this guide, we'll explore how to integrate ChatGPT, an AI-powered chatbot, with a Laravel…

4 days ago

What are Net Sales? How to Calculate Your Net Sales?

In the world of business, understanding financial metrics is crucial for making informed decisions and…

6 days ago

Magento 2 Extensions Digest April 2024 (New Release & Updates)

Welcome to the MageComp Monthly Digest, where we bring you the latest updates, releases, and…

6 days ago

The ABCs of Geofencing: Definition, Features and Uses

In this era, businesses are always on the lookout for ways to engage with their…

1 week ago

How to Delete Product Variant in a Shopify Remix App using GraphQL Mutations?

Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…

1 week ago