14

Is it possible to disable the shipping price if the order total is over a certain amount? I was thinking maybe a conditional in the checkout template but I havent gotten it to work. Does anyone have any ideas or could point me in the right direction? Thanks!

10

You didn't mention in the question you were trying to do this in addition to USPS.

The answer @MediaGirl gave would be correct if you were using the Default Shipping Plugin, as you can simply create extra rules to apply free shipping to orders over $50 (or whatever).

If you want to do this in combination with USPS rates, you will need to make a simple PHP shipping plugin which extends the USPS plugin and adds your custom rule.

For example, create a new file third_party/store/libraries/store_shipping/store_shipping_usps_with_max.php, with the following contents:

require_once dirname(__FILE__).'/store_shipping_usps.php';
class Store_shipping_usps_with_max extends Store_shipping_usps
{
    public function calculate_shipping($order)
    {
        // free shipping for orders over $50
        if ($order['order_shipping_subtotal_val'] >= 50)
        {
            return 0;
        }

        return parent::calculate_shipping($order);
    }
}

You should then be able to install and configure this new Store_shipping_usps_with_max plugin the same way you did the regular USPS plugin, but it will have the extra feature of free shipping on orders over $50


Another option if you don't want to go the PHP route, would be to simply add some conditionals to your checkout template, to automatically submit hidden fields for the free shipping method:

{if order_total_val > 50}
    <input type="hidden" name="shipping_method" value="id_of_free_shipping_method" />
{if:else}
    <input type="hidden" name="shipping_method" value="id_of_usps_shipping_method" />
{/if}
  • I'm trying to combine that into UPS and FedEx shipping methods, but how I can get IDs of both of those? – JackTheKnife Mar 7 '14 at 17:39
  • That depends. In Store v2 the UPS and FedEx methods generate multiple shipping options, so they have multiple 'IDs'. You would need to output the {field:shipping_method} dropdown to see what the IDs are. – Adrian Macneil Mar 8 '14 at 8:53
  • First - there is a problem with Store v2 and UPS method (reported separately) to get IDs at the beginning of the checkout. Second - as you mentioned UPS method generates multiple shipping options and in that case I don't know which ID was chosen. Also IDs look like Store_ups_ext:XX so I'm not sure if I need to post whole part as a value. Personally I prefer to go with PHP version, but presented above is not working with current UPS add-on. – JackTheKnife Mar 12 '14 at 13:50
  • This answer was written quite a while ago for Store 1.x so probably best to start fresh. See expressionengine.stackexchange.com/a/20202/150 for a way to achieve this in Store 2. – Adrian Macneil Mar 12 '14 at 21:53
10

You don't need a conditional...

Set up a shipping method called Free Shipping using the Default Shipping Plugin.

Then set up the rules for this new shipping method... you'll want to set Minimum Order Total and Maximum Order Total specific to your use case. Then set your Base Rate charge to 0. Should do the trick.

Info on Shipping Methods is here in the docs: https://exp-resso.com/docs/store/settings/shipping_methods.html

  • Its still giving me two options for shipping: Free Shipping free and usps. – ee_dogg Nov 22 '12 at 0:35
  • Are you able to set order total minimum and maximum for the USPS method? – Anna_MediaGirl Nov 22 '12 at 16:31
  • No, I'm not able to set a total minimum and maximum for the USPS method. This is bizzare. Before I posted this I was using 1.6.0 and I Just updated to store 1.6.1 still the same problem. It will show the USPS Shipping and Free Shipping options when under $100.00 – ee_dogg Nov 23 '12 at 18:50
  • Adrian provided two options for you in his answer. – Anna_MediaGirl Nov 23 '12 at 20:46
  • 2
    That worked! Adrian is a beast! – ee_dogg Nov 23 '12 at 22:33

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.