We want to add Discount coupon code box on checkout page.
This coupon code box showing only on cart page we also want on checkout page.
-
Can you show screenshot where you want to show coupon on checkout?– Chirag RajputApr 5, 2018 at 11:40
-
yes we added screen shot– Neha KhedkarApr 5, 2018 at 11:58
-
Please check my answer and let me know– Chirag RajputApr 5, 2018 at 13:39
2 Answers
Open your theme files checkout.xml in layout app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout/checkout.xml
You can see code for replace that code with below:
<checkout_onepage_index translate="label">
<label>One Page Checkout</label>
<!-- Mage_Checkout -->
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
<reference name="right">
<action method="unsetChildren"></action>
<block type="page/html_wrapper" name="checkout.progress.wrapper" translate="label">
<label>Checkout Progress Wrapper</label>
<action method="setElementId"><value>checkout-progress-wrapper</value></action>
<block type="checkout/onepage_progress" name="checkout.progress" before="-" template="checkout/onepage/progress.phtml">
<block type="checkout/onepage_progress" name="billing.progress" template="checkout/onepage/progress/billing.phtml"></block>
<block type="checkout/onepage_progress" name="shipping.progress" template="checkout/onepage/progress/shipping.phtml"></block>
<block type="checkout/onepage_progress" name="shippingmethod.progress" template="checkout/onepage/progress/shipping_method.phtml"></block>
<block type="checkout/onepage_progress" name="payment.progress" template="checkout/onepage/progress/payment.phtml"></block>
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
</block>
</block>
</reference>
<reference name="content">
<block type="checkout/onepage" name="checkout.onepage" template="checkout/onepage.phtml">
<block type="checkout/onepage_login" name="checkout.onepage.login" as="login" template="checkout/onepage/login.phtml">
<block type="page/html_wrapper" name="checkout.onepage.login.before" as="login_before" translate="label">
<label>Login/Registration Before</label>
<action method="setMayBeInvisible"><value>1</value></action>
</block>
</block>
<block type="checkout/onepage_billing" name="checkout.onepage.billing" as="billing" template="checkout/onepage/billing.phtml"/>
<block type="checkout/onepage_shipping" name="checkout.onepage.shipping" as="shipping" template="checkout/onepage/shipping.phtml"/>
<block type="checkout/onepage_shipping_method" name="checkout.onepage.shipping_method" as="shipping_method" template="checkout/onepage/shipping_method.phtml">
<block type="checkout/onepage_shipping_method_available" name="checkout.onepage.shipping_method.available" as="available" template="checkout/onepage/shipping_method/available.phtml"/>
<block type="checkout/onepage_shipping_method_additional" name="checkout.onepage.shipping_method.additional" as="additional" template="checkout/onepage/shipping_method/additional.phtml"/>
</block>
<block type="checkout/onepage_payment" name="checkout.onepage.payment" as="payment" template="checkout/onepage/payment.phtml">
<block type="checkout/onepage_payment_methods" name="checkout.payment.methods" as="methods" template="checkout/onepage/payment/info.phtml">
<action method="setMethodFormTemplate"><method>purchaseorder</method><template>payment/form/purchaseorder.phtml</template></action>
</block>
<block type="core/template" name="checkout.onepage.payment.additional" as="additional" />
<block type="core/template" name="checkout.onepage.payment.methods_additional" as="methods_additional" />
</block>
<block type="checkout/onepage_review" name="checkout.onepage.review" as="review" template="checkout/onepage/review.phtml"/>
</block>
</reference>
</checkout_onepage_index>
And put the following code in app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template/checkout/onepage/progress.phtml
<div class="block block-progress opc-block-progress<?php if (!$this->isCustomerLoggedIn()/* && !$this->getCheckout()->getStepData('billing', 'is_show')*/): ?> opc-block-progress-step-login<?php endif; ?>">
<div class="block-title">
<strong><span><?php echo $this->__('Your Checkout Progress') ?></span></strong>
</div>
<div class="block-content">
<dl>
<?php if ($this->getCheckout()->getStepData('billing', 'is_show')): ?>
<div id="billing-progress-opcheckout">
<?php echo $this->getChildHtml('billing.progress') ?>
</div>
<?php endif; ?>
<?php if ($this->getCheckout()->getStepData('shipping', 'is_show')): ?>
<div id="shipping-progress-opcheckout">
<?php echo $this->getChildHtml('shipping.progress') ?>
</div>
<?php endif; ?>
<?php if ($this->getCheckout()->getStepData('shipping_method', 'is_show')): ?>
<div id="shipping_method-progress-opcheckout">
<?php echo $this->getChildHtml('shippingmethod.progress') ?>
</div>
<?php endif; ?>
<?php if ($this->getCheckout()->getStepData('payment', 'is_show')): ?>
<div id="payment-progress-opcheckout">
<?php echo $this->getChildHtml('payment.progress') ?>
</div>
<?php endif; ?>
<?php echo $this->getChildHtml('coupon') ?>
</dl>
</div>
You can see below screenshot for result:
Then clear cache and check.
-
Hi, both File Path are not Matched with our path, do we need to create that file if it is not available path shared by you Apr 6, 2018 at 11:39
-
Yes if that file is not in your theme then you need to create that file at above mentioned path. let me know if you want more detail help. Apr 7, 2018 at 5:00
In checkout.xml
layout file add as following,
<block type="checkout/onepage_review_info" name="root" output="toHtml" template="checkout/onepage/review/info.phtml">
...
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
...
</block>
And put the following code in app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template/checkout/onepage/review/info.phtml
<?php echo $this->getChildHtml('coupon') ?>
-
-
-
1
-
After applying promo code it redirect to cart page. How to change this behaviour Oct 29, 2019 at 10:53