2

I made a shopping cart promotion that allows products with the "free shipping" attribute set to "yes" to be shipped for free. But for some reason, instead of just showing the free shipping option at checkout it, it shows the free shipping option and then shows all other options at a cost of $0.00. How do I make it so that it only shows the free shipping option but keeps the others the same?

I should clarify I am trying to add free shipping to a single item.

Also, the problem is that all shipping types turn out to be free. Overnight and 37 day ground are the same cost.

3 Answers 3

4

The shopping cart option is not designed to show the free shopping option but to discount the shipping quantity. What you probably want is to enable the Magento Free shipping method and set a threshold of X amount so any orders over that threshold will have the freeshipping option available

2
  • Right so I made a shopping cart price rule for things with the "free shipping" attribute. I would just do what you're saying but we're trying to set free shipping for one item. Thoughts? Aug 27, 2013 at 21:01
  • I see for only a single item, I would recommend using one of the webshopapps.com extensions. The SHIPPING OVERRIDE extension would work exactly for the scenario you are describing. Aug 28, 2013 at 14:08
2

In you cart rule, under 'actions' tab, there is an option to apply only to cart items that meet the condition.

You need to set a rule for that items sku, and the free shipping will only be applied to that item

apply only to items action

Using this, you don't event need a 'free shipping' custom attribute.

1
  • That's a solid idea, but I still have the same problem that the free shipping is for any type of shipping. \ Aug 28, 2013 at 2:43
1

So this is a little tricky but doable. Keep in mind that I was doing this on Magento EE 1.13.

  1. First set up a new Shopping Cart Price Rule located under Promotions->Shopping Cart Price Rules

  2. Next,under Rule Information->Coupon, select "No Coupon"

  3. Under Conditions create condition "Shipping Method is [shipping method]"
  4. Under Actions, set Discount Amount to 0, set Free Shipping to "For Shipment with Matching Items" and create a condition "Price in cart greater than 0.01"

Save the promotion and it should now apply to the shipping method. At first glance all the shipping methods will appear with their typical price, once the user selects the shipping method you set for the promotion, it will then be applied to the final subtotal.

However, there is a catch. If the user reenters the checkout at an earlier phase (i.e. leaves the checkout page than checks out again or selects a previous checkout step prior to the shipping methods step) once they hit the shipping methods step every shipping method will appear to be free shipping. I believe this is the problem that you are having.

So why is this happening? If you step through the code in a debugger, you will find that two things have happened. When the user goes through the Shipping Method step of the checkout process, the promotion related to the currently selected shipping method is applied. Magento stores this shipping method in the quote's address object itself, thus on the shipping methods, if the shipping method is already selected, Magento will think that free shipping applies and will apply it to every single shipping method. Selecting a different shipping method (one that the promotion does not apply to) then getting to the order subtotal page will reset the promotions resulting in the correct shipping method prices being displayed again.

How do we get around it? Although it isn't ideal, rewrite the app\design\frontend\base\default\template\checkout\onepage\shipping_method\available.phtml file in your own design folder, and add the following code to you new template file:

$this->getQuote()->getShippingAddress()->setCollectShippingRates(true);
$this->getAddress()->setShippingMethod(null);
$this->getAddress()->setFreeShipping(false);

Why do we need to do this? We are somewhat tricking Magento here. Magento will look to see if it needs to generate new shipping rates when the payment step of onepage checkout is called. If getCollectShippingRates() returns false, then it won't search for rates. For this reason, we are telling Magento, yes you need to look again. Setting shippingMethod to null will tell Magento that there isn't a shipping method selected thus not applying the promotion again. Lastly, setFreeShipping(false) will tell Magento that no promotion has been applied for free shipping yet. Basically we are resetting the shipping method selection for the quote by doing this.

1
  • Emil, where exactly should I put those 3 lines in available.phtml?
    – sellio
    Feb 23, 2016 at 11:21

Your Answer

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

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