I'm using CartThrob v2.3.2 on a site where the client would like to have free shipping on orders over £50 which is easily setup in the shipping options.

However, when a customer uses a coupon code or discount it can bring the order total below £50 but the shipping remains free.

So how can I set it up so that the free shipping is only applied after any discounts have been subtracted from the order total?

1 Answer 1


The best way to do this would be with a custom shipping plugin. You can copy the existing one and update the logic to look for the post-discount total.

  1. Copy Cartthrob_discount_free_shipping_over_x.phpand call it Cartthrob_discount_free_shipping_over_x_after_discount.php.
  2. Rename Cartthrob_discount_free_shipping_over_x class to Cartthrob_discount_free_shipping_over_x_after_discount.
  3. Change $title to Free Shipping Over X After Discount.

Then, change the following code:

if ($this->core->cart->subtotal() >= $this->core->sanitize_number($this->plugin_settings('order_over')))


if (($this->core->cart->subtotal() - $this->core->cart->discount()) >= $this->core->sanitize_number($this->plugin_settings('order_over')))

Feel free to let us know if you need help with that!

  • Thanks Matt, is there any other way of doing it without having to create a custom plugin?
    – Wes
    Commented Feb 2, 2016 at 16:41
  • @Wes doing that is best, and I've now added better instructions for it to my answer.
    – Matt
    Commented Feb 2, 2016 at 20:09
  • Thanks for the more detailed reply Matt, that's very helpful. Sorry one more thing, we are using the shipping plugin 'By Location - Price Threshold' as the client sells to other countries on occasion. Forgive my lack of understanding here (I have played around with the shipping plugins before), but once I have created this new shipping plugin how can I use it alongside the location plugin above?
    – Wes
    Commented Feb 3, 2016 at 9:10
  • @Wes in this case, you'd want to make a single custom shipping plugin that combines the features of both, with the exact logic you want (location threshold and post-discount free shipping). You could start by copying "By Location - Price Threshold" and adding the discount logic from above. Feel free to get in touch if you'd like us to help!
    – Matt
    Commented Feb 4, 2016 at 3:57

Your Answer

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

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