Q: Is it possible to disable a coupon code based on shipping method.
We have enabled store pickup but would not like customers who pickup in store with online prices to be able to use a coupon code.
Is there a way to disable this?
Thanks
Q: Is it possible to disable a coupon code based on shipping method.
We have enabled store pickup but would not like customers who pickup in store with online prices to be able to use a coupon code.
Is there a way to disable this?
Thanks
The discount coupon module would need a code to see the shipping selection the customer has chosen in the cart.
Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
Twitch Base8 - Obsidian - This, is what's new.
You could add the code in RED to the file:
/includes/modules/order_total/ot_coupon.php
around line 212:
see if that works the way you are wanting it to ...Code:// bof: do not allow discount coupons on storepickup if (substr_count($_SESSION['shipping']['id'], 'storepickup') !=0) { $foundvalid = false; } // eof: do not allow discount coupons on storepickup if (!$foundvalid) { $this->clear_posts(); }
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Thanks this worked perfectly!
Thanks for the update that this was able to work for you ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Ajeh, I have played with your suggested code and tried a few varieties.
No doubt, your hack disables coupons for Store Pickup - BUT: the customer is getting an error message (as they should) and needs to go through the checkout pages again to complete the order.
IMHO, it would be more 'elegant' to simply not display (= disable) the fieldset on the checkout_payment page where coupon codes may be entered.
IOW: there should be no facility to enter a coupon code if (on the previous page checkout_shipping) Store Pickup was selected as a shipping method.
I looked at includes/modules/pages/checkout_shipping/header_php.php (and the corresponding template file) and then applied a few conditions but only had limited success.
What can you suggest?
Thanks / Frank
Last edited by frank18; 15 Mar 2014 at 10:36 AM.
You will need two parts to the code in case the customer first picks another shipping method ...
So, leave in the code that I first gave you, then add the code in RED:
This will make the Discount Coupon disappear if the customer first chooses Store Pickup and if they first choose another shipping module then change their mind it will still clear out the Discount Coupon they were trying to use ...Code:function credit_selection() { global $discount_coupon; // note the placement of the redeem code can be moved within the array on the instructions or the title // bof: do not allow discount coupons on storepickup if (substr_count($_SESSION['shipping']['id'], 'storepickup') !=0) { $this->clear_posts(); } else { $selection = array('id' => $this->code, 'module' => $this->title, 'redeem_instructions' => MODULE_ORDER_TOTAL_COUPON_REDEEM_INSTRUCTIONS . ($discount_coupon->fields['coupon_code'] != '' ? MODULE_ORDER_TOTAL_COUPON_REMOVE_INSTRUCTIONS : '') . ($discount_coupon->fields['coupon_code'] != '' ? MODULE_ORDER_TOTAL_COUPON_TEXT_CURRENT_CODE . '<a href="javascript:couponpopupWindow(\'' . zen_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $_SESSION['cc_id']) . '\')">' . $discount_coupon->fields['coupon_code'] . '</a><br /><br />' : ''), 'fields' => array(array('title' => MODULE_ORDER_TOTAL_COUPON_TEXT_ENTER_CODE, 'field' => zen_draw_input_field('dc_redeem_code', '', 'id="disc-' . $this->code . '" onkeyup="submitFunction(0,0)"'), 'tag' => 'disc-'.$this->code ))); } // eof: do not allow discount coupons on storepickup return $selection; }
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Thanks for the update that this is working for you ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Bookmarks