Totally Zenned
- Join Date:
- May 2008
- Location:
- United States
- Posts:
- 520
- Plugin Contributions:
- 2
Restrict coupon code on PO Box shipping addresses
I'm trying to restrict a coupon code that gives free shipping to PO Box shipping addresses. I ship with three carriers UPS, FedEx, and USPS. I customized UPS and FedEx shipping modules to disable using the following statement:
if ( preg_match('/PO BOX/si', $order->delivery['street_address'])) {
$this->enabled = false;
$po_box_address = true;
} else if ( preg_match('/POBOX/si', $order->delivery['street_address'])) {
$this->enabled = false;
$po_box_address = true;
} else if ( preg_match('/P\.O\./si', $order->delivery['street_address'])) {
$this->enabled = false;
$po_box_address = true;
} else if ( preg_match('/P\.O/si', $order->delivery['street_address'])) {
$this->enabled = false;
$po_box_address = true;
} else if ( preg_match('/PO\./si', $order->delivery['street_address'])) {
$this->enabled = false;
$po_box_address = true;
}
That part works perfect and forces PO Box shipping address to have only USPS as a selection. Now I need to restrict a certain coupon code: "XXXXX" from being used for free shipping on PO Box shipping addresses only. ** A billing address can be a PO Box just not the shipping address.
I was thinking either ot_coupon.php file or coupon_restrict.php needs to be modified for this just not sure how to properly do it. Can anyone help on this?