cancel
Showing results for 
Search instead for 
Did you mean: 

Promo Code Required Field

Promo Code Required Field

Does anyone know how to make the 'Promo Code' box at checkout a required field?

5 REPLIES

Re: Promo Code Required Field

change onclick attribute value of the process to checkout buttons(more than one) to

discountForm.submit(false)

Re: Promo Code Required Field

We tried suggestion, but it did not make the coupon code a required field. What are the file names that need to be changed?

Required Fiels

Tags (2)

Re: Promo Code Required Field

checkout/onepage/link.phtml

can I have your website url? your template may work difeferently

 

and also when frontend works, you have to rewrite cart controller couponPost action method to redirect to onepage checkout

Re: Promo Code Required Field

Re: Promo Code Required Field

Hi @steve2bright,

To make this feature, you can do by steps below:

On checkout cart page, you add class "required-entry" via input text coupon code. After that change attribute onclick in the button Proceed to Checkout by 1 function javascript as below:

 

function processToCheckout(){
   var validForm =  new varienForm('discount-coupon-form');
   if (validForm .validate()) {
       window.location='http://www.unicaddy.com/checkout/onepage/';
   }
}

 

After that, if you want to check require coupon on checkout onepage you can catch event: "controller_action_predispatch_checkout_onepage_index" with function as bellow:

 

function initCheckoutController($observer){
    if(!Mage::getSingleton('checkout/cart')->getQuote()->getCouponCode()){
            $observer->getControllerAction()->_redirect('checkout/cart');
    }
}

Hope it's helpful for you.

MageWoo

 

 

 

Best Magento Extensions and Services: One Step Checkout, POS Pro, Social Login, Delivery Date...
www.magewoo.com