1

I asked this question previously and am still having trouble. I want to bypass shipping options for items with free shipping.

I added this code to the shipping options page:

 {if order_shipping_val == 0}
    {redirect="Store/Confirm-Order"}
{/if}

Unfortunately it redirects for all items including ones that should have paid shipping. Any ideas?

1

If you want to do that, you need to make sure your regular orders definitely have a shipping cost. You should make sure there is a default shipping method set, and that there is a default country/state set as well, so that all orders have a shipping cost associated with them as soon as an item is added to the cart.

To debug it, try outputting {order_shipping} directly onto the page instead of the redirect code, and make sure that it returns a non-zero value even for new carts.

EDIT: If you are using the UPS extension it's a bit more difficult, because you can't set UPS as the default shipping method. You will need to check if the cart has a valid shipping method, and if not, reload the page.

First, I would delete any regular shipping methods you have set up (if you are 100% using UPS for shipping).

Then, create a check to make sure the current cart has a shipping method selected before redirecting to the next step:

{if shipping_method == ""}
    {field:shipping_method}
    <script type="text/javascript">
        $("#next-button").click(); // trigger a form submit
    </script>
{if:else}
    {!-- now we know a shipping method has been selected --}
    {if order_shipping_val == 0}
        {redirect="Store/Confirm-Order"}
    {/if}
{/if}

<input type="submit" id="next-button" />
| improve this answer | |
  • Thank you your quick response. Unfortunately, I'm still having a issue. I go from Add to Cart > Check Out > Shipping Address > Shipping Options. I add the {order_shipping} variable which comes back as $0 every time. The added shipping options like UPS with correct prices show, though. I added a default shipping option, but no luck. Any idea? Thank you. – user2376 Jan 17 '14 at 19:36
  • Oh ok it's going to be different if you are using the UPS extension (because you can't set UPS as the default shipping method). See my edit above. – Adrian Macneil Jan 17 '14 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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