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:
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
[B]// bof: do not allow discount coupons on storepickup
if (substr_count($_SESSION['shipping']['id'], 'storepickup') !=0) {
$this->clear_posts();
} else {
[/B] $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
)));
[B] }
// eof: do not allow discount coupons on storepickup
[/B] return $selection;
}
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 ...