Magento – Add Discount coupon code box on checkout page in magento 1.9

cartcheckoutcouponmagento-1.9

enter image description hereWe 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.

Best Answer

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:

enter image description here

Then clear cache and check.

Related Topic