Forums / Discounts/Coupons, Gift Certificates, Newsletters, Ads / Free Shipping coupon for 1 item makes all shipping free

Free Shipping coupon for 1 item makes all shipping free

Started by phil_s on 18 Feb 2015, 10:33 PM · Views: 4,562

Results 1 to 16 of 16
18 Feb 2015, 10:33 PM
#1
phil_s avatar

phil_s

New Zenner

Join Date:
Mar 2008
Posts:
49
Plugin Contributions:
0

Free Shipping coupon for 1 item makes all shipping free

I've been trying to add a Free Shipping coupon and can't get it to work the way I think it should.

Under Restrictions I have Top *Deny *and the products Main Category either Allow or Deny. (The outcome is the same) I then set the Product ID to Allow.

If I do not have the product in my cart, the coupon is denied as it should be. If I have the product in the cart along with anything else in the store, the entire shipping cost on the whole order is refunded instead of just the item.

Is that the way it's supposed to work or am I missing something?

18 Feb 2015, 11:32 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping coupon for 1 item makes all shipping free

Unfortunately, this has never worked for restricted Products only and has always been for a total Free Shipping if there is 1 or more qualifying Products ...

This is being looked into, but I am not having a good time with it ... :(

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!]
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!

19 Feb 2015, 1:39 AM
#3
phil_s avatar

phil_s

New Zenner

Join Date:
Mar 2008
Posts:
49
Plugin Contributions:
0

Re: Free Shipping coupon for 1 item makes all shipping free

Well at least it wasn't anything I was doing wrong. :)
Hopefully a solution will be found but I'm not sure there's enough demand to make it a priority.
Thanks!

17 Mar 2015, 7:33 PM
#4
gxlinx01 avatar

gxlinx01

New Zenner

Join Date:
Mar 2011
Posts:
24
Plugin Contributions:
0

Re: Free Shipping coupon for 1 item makes all shipping free

I ran into this issue today. Is it possible to make this a feature or a fix?

There is a coupon that applies free shipping. It is allowed for one product but denied from the other product.

If customer adds the product with the coupon for free shipping then adds the denied product the whole order gets free shipping.

17 Mar 2015, 9:34 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping coupon for 1 item makes all shipping free

There is not a way to do this at this time ... A Discount Coupon for Free Shipping is for the whole order and does not work on just Product limits ...

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!]
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!

18 Mar 2015, 1:48 PM
#6
gxlinx01 avatar

gxlinx01

New Zenner

Join Date:
Mar 2011
Posts:
24
Plugin Contributions:
0

Re: Free Shipping coupon for 1 item makes all shipping free

Thanks Ajeh. Do you know if there are any plans for implementing this in the future?

Also any tips if I wanted to undertake this myself?

18 Mar 2015, 2:15 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping coupon for 1 item makes all shipping free

I keep working on trying a solution ... not a good day on this ... :blink:

What shipping modules do you use, just so I keep them in mind when working on this ...

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!]
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!

18 Mar 2015, 2:41 PM
#8
gxlinx01 avatar

gxlinx01

New Zenner

Join Date:
Mar 2011
Posts:
24
Plugin Contributions:
0

Re: Free Shipping coupon for 1 item makes all shipping free

We use Ceon Advanced Shipper.

Might have to reach out to them?

18 Mar 2015, 3:58 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping coupon for 1 item makes all shipping free

Not sure yet ... you can contact them about the issue but meanwhile I will keeping plugging away ...

In your Advanced shipper, what shipping methods are you using? :lookaroun

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!]
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!

18 Mar 2015, 6:26 PM
#10
gxlinx01 avatar

gxlinx01

New Zenner

Join Date:
Mar 2011
Posts:
24
Plugin Contributions:
0

Re: Free Shipping coupon for 1 item makes all shipping free

The shipping is tier based but some of those products also have optional addons that add to the shipping. So it is based on the Product purchased, the number of the product purchased, and weight of said product with or without addons.

4 Jan 2016, 6:20 PM
#11
chris_stackhouse avatar

chris_stackhouse

New Zenner

Join Date:
Aug 2014
Location:
Washington Township, Gloucester County, New Jersey, United States
Posts:
11
Plugin Contributions:
0

Re: Free Shipping coupon for 1 item makes all shipping free

Anyone ever figure this one out? I'm stuck in this same situation where my client needs to offer a free shipping coupon but only on certain items. It would even be acceptable if instead it would just refuse to validate the coupon and display a warning if the cart contains items that are not specifically allowed by the coupon. I suppose we would need to compare an array of the items in the cart to an array of allowed items in the coupon restrictions. In fact, the basic functionality for this proposed solution should already exist in normal coupon validation as a condition of proceeding beyond Step 2 of the checkout process. I will investigate.

4 Jan 2016, 9:06 PM
#12
chris_stackhouse avatar

chris_stackhouse

New Zenner

Join Date:
Aug 2014
Location:
Washington Township, Gloucester County, New Jersey, United States
Posts:
11
Plugin Contributions:
0

Re: Free Shipping coupon for 1 item makes all shipping free

The following solution seems to be working as I intended in my previous post.

Around line 200 of includes/modules/order_total/ot_coupon.php

 

        $products = $_SESSION['cart']->get_products();
        $foundvalid = true;

        if ($foundvalid == true) {
          $foundvalid = false;
          for ($i=0; $i<sizeof($products); $i++) {
            if (is_product_valid($products[$i]['id'], $coupon_result->fields['coupon_id'])) {
              $foundvalid = true;
              continue;
            }
          }
		}
//BOF Restrictive Free Shipping -- Invalidate Coupon if order contains ANY restricted items
	 if ($coupon_result->fields['coupon_type'] == 'S') {
 	$products = $_SESSION['cart']->get_products();
 	$validproducts = 0;
	$totalproducts= sizeof($products);
          
          for ($i=0; $i<sizeof($products); $i++) {
            if (is_product_valid($products[$i]['id'], $coupon_result->fields['coupon_id'])) {
              $validproducts= $validproducts +1;
              continue;
            }
          }
		}
	 

if ($totalproducts > $validproducts) {
		  $messageStack->add_session('redemptions', TEXT_INVALID_RESTRICTIVE_FREE_SHIPPING,'caution');
          $this->clear_posts();
          zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL',true, false));
}
//EOF Restrictive Free Shipping

        if (!$foundvalid) {
          $this->clear_posts();
        }

add the following line somewhere in includes/languages/custom/english.php :

define('TEXT_INVALID_RESTRICTIVE_FREE_SHIPPING', 'Some items in your cart do not qualify for FREE SHIPPING.  Remove them and re-enter coupon code.'
5 Jan 2016, 12:24 AM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping coupon for 1 item makes all shipping free

Thanks for the update on how you handled this ... I always assumed that was an obvious thing to do but it helps to know a simple solution like that (but simple is simple to us and not the average store owner) is posted on the Free Forums ... :smile:

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!]
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!

5 Jan 2016, 1:19 AM
#14
chris_stackhouse avatar

chris_stackhouse

New Zenner

Join Date:
Aug 2014
Location:
Washington Township, Gloucester County, New Jersey, United States
Posts:
11
Plugin Contributions:
0

Re: Free Shipping coupon for 1 item makes all shipping free

No problem. I also intend to add an additional configuration value to TABLE_COUPONS and edit admin/coupon_admin.php to insert a checkbox so that Restrictive Free Shipping can be toggled on or off for each individual coupon code. I will post an update when its complete.

5 Jan 2016, 1:29 AM
#15
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping coupon for 1 item makes all shipping free

What specifically is the restriction that you want for the checkbox? :lookaroun

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!]
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!

7 Jun 2016, 10:29 PM
#16
bislewl avatar

bislewl

Totally Zenned

Join Date:
Dec 2011
Location:
Wisconsin, USA
Posts:
674
Plugin Contributions:
12

Re: Free Shipping coupon for 1 item makes all shipping free

I had the same issue today where it was desired to have a "Free Shipping" coupon apply only to certain products, and if excluded products where in there they would be charged the difference of the shipping cost. So I thought I would share.

Here is some general direction how to accomplish it, you will need some coding experience to make this work for your store this is just a general idea. This also really only works for stores that don't charge tax on shipping & are restricting the coupon on a per product level, NOT per category. So you would need to modify it further to do that. ALSO it doesn't account for % or additional discount besides to free shipping. But it is here to help provide so general direction.

Everything I did was in the includes/modules/order_total/ot_coupon.php

in the process() function comment out so the customer see the actual complete shipping cost:
if ($od_amount['type'] == 'S' || $od_amount['type'] == 'E' || $od_amount['type'] == 'O') $order->info['shipping_cost'] = 0;

towards then end of the calculate_deductions() function:
After the end of the switch ($this->calculate_tax) {
}

I added this:

$coupon_restrictions = $db->Execute("SELECT * FROM " . TABLE_COUPON_RESTRICT . " WHERE coupon_id='" . (int)$_SESSION['cc_id'] . "'");
                    if (in_array($coupon->fields['coupon_type'], array('S', 'E', 'O')) && $coupon_restrictions->RecordCount() > 0) {
                        $restricted_items = array();
                        $allowed_items = array();
                        $restricted_items_in = array();
                        $allowed_items_in = array();
                        while (!$coupon_restrictions->EOF) {
                            if ($coupon_restrictions->fields['coupon_restrict'] == 'Y') {
                                $restricted_items[] = $coupon_restrictions->fields['product_id'];
                                if ($_SESSION['cart']->get_products($coupon_restrictions->fields['product_id']) > 0) {
                                    $restricted_items_in[] = $coupon_restrictions->fields['product_id'];
                                }
                            } else {
                                $allowed_items[] = $coupon_restrictions->fields['product_id'];
                                if ($_SESSION['cart']->get_products($coupon_restrictions->fields['product_id']) > 0) {
                                    $allowed_items_in[] = array('product_id' => $coupon_restrictions->fields['product_id'],
                                        'quantity' => $_SESSION['cart']->get_quantity($coupon_restrictions->fields['product_id']),
                                        'weight' => zen_products_lookup($coupon_restrictions->fields['product_id'], 'products_weight')
                                    );
                                }
                            }
                            $coupon_restrictions->MoveNext();
                        }
                        if (count($allowed_items_in) > 0 && count($restricted_items_in) > 0) {
                            $od_amount['total'] = $this->_get_ups_cost_for_free_ship_items($allowed_items_in);
                        }
                    }

In this case using UPS shipping module, so I created a function _get_ups_cost_for_free_ship_items() to basically make a call to UPS and determine the shipping cost for those that are allowed, and the re-adjusting the total discount amount with the shipping cost for those approved products