Hello Magento Friends ?,
Today I will illustrate How to Remove Apply Discount Code From Checkout Payment Page in Magento 2. Let’s check out our previous blog, Magento 2: How to Add Custom Sidebar On Checkout Page. So, let’s start on ?
Contents
Discounts and offers are provided to the products and services in order to attract customers towards the store. The customers are likely to purchase more when they find any discounts. Besides, visitors can be easily converted into customers with the help of it.
But discounts are applied to the products or services for a specific period of time. After that, the store owner needs to remove or disable the discount code from the product payment page. Also, when the discount is applied only for a particular group of customers, the product payment page of other customer groups must not show the discount code.
Hence, let us find out the way to fulfill the above necessity.
Remove Apply Discount Code From Checkout Payment Page in Magento 2 involves two methods to implement it.
Method 1: Using the CSS file
Enter the below code in your custom CSS file.
.checkout-index-index .payment-option._collapsible.opc-payment-additional.discount-code { display: none; }
Method 2: Using the XML file
Move to the following path
app/design/frontend/VENDOR/THEME/Magento_Checkout/layout/checkout_index_index.xml
And enter the below code
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="checkout.root"> <arguments> <argument name="jsLayout" xsi:type="array"> <item name="components" xsi:type="array"> <item name="checkout" xsi:type="array"> <item name="children" xsi:type="array"> <item name="steps" xsi:type="array"> <item name="children" xsi:type="array"> <item name="billing-step" xsi:type="array"> <item name="children" xsi:type="array"> <item name="payment" xsi:type="array"> <item name="children" xsi:type="array"> <item name="afterMethods" xsi:type="array"> <item name="children" xsi:type="array"> <item name="discount" xsi:type="array"> <item name="config" xsi:type="array"> <item name="componentDisabled" xsi:type="boolean">true</item> </item> </item> </item> </item> </item> </item> </item> </item> </item> </item> </item> </item> </item> </argument> </arguments> </referenceBlock> </body>
Now run the below commands to view the effect
php bin/magento cache:clean php bin/magento cache:flush
Therefore, now everyone is able to Remove Apply Discount Code From Checkout Payment Page in Magento 2. While implementing the code, if you come across any difficulty notify me in the comment section below. Share the article with your Magento Developer buddies. Stay in the know for more such solutions.
Happy Coding ?
Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…
E-commerce has transformed the way consumers shop for products and services and interact with businesses.…
The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…
Hello Magento Friends, In today’s blog, we will discuss adding a header and footer to…
Hello React Native Friends, Building a visually appealing and responsive mobile app is crucial in…
We have brought exciting news for Magento store owners. Hyvä Themes recently released 1.3.6 and…
View Comments
true
Your file is missing some thing please update above code