1

I am working on Drupal commerce site. Using commerce_discount_extra and commerce_discount for discount and coupon code.

I just want to display Coupon apply filed into checkout page while the total amount of order will be >=$500. Below $500 the coupons field will not display into checkout page.

So can anyone please tell me how can I disable the Coupons fields from checkout page when the order amount will be less than $500?

Thanks in advance.

enter image description here

1 Answer 1

2

Hope it works.

function module_form_commerce_checkout_form_checkout_alter(&$form, &$form_state, $form_id) {

  if ($form_state['order']->commerce_order_total['und'][0]['amount'] < 500) {
    unset($form['commerce_coupon']); // enter coupon form name
  }
}
2
  • Thanks Vamsi, This is working fine for me. Just replace unset($form['commerce_discount']); to unset($form['commerce_coupon']);
    – Mash
    Jun 23, 2016 at 13:35
  • @Mash replaces with commerce_coupon
    – Vamsi
    Jun 24, 2016 at 4:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.