<p>The current rule for the total in Commerce 1 is in <code>craft/plugins/commerce/models/Commerce_ShippingRuleModel.php</code> starting at line 214: </p>

<pre><code>if ($this-&gt;minTotal &amp;&amp; $this-&gt;minTotal &gt; $order-&gt;itemTotal)
{
    return false;
}
if ($this-&gt;maxTotal &amp;&amp; $this-&gt;maxTotal &lt;= $order-&gt;itemTotal)
{
    return false;
}
</code></pre>

<p>Try changing it to use totalPrice and see if that resolves the issue for you:</p>

<pre><code>if ($this-&gt;minTotal &amp;&amp; $this-&gt;minTotal &gt; $order-&gt;totalPrice)
{
    return false;
}
if ($this-&gt;maxTotal &amp;&amp; $this-&gt;maxTotal &lt;= $order-&gt;totalPrice)
{
    return false;
}
</code></pre>

<p>If we were to go ahead and change it in core, it would be a breaking change for other users. The only way around that is to make a new setting.</p>

<p>If it resolves the issue for you, I will look into making the new setting.</p>

CC BY-SA 4.0
2019-05-20T15:26:48.177Z
Is there any plan to add this setting? We have a situation where we want the shipping to apply after the discount.
Trevor Davis
CC BY-SA 4.0
2018-07-23T07:08:32.760Z
2018-07-23T07:08:32.760Z
Luke Holder
<p>I have a webshop where you can get free shipping when the minimum total order price is €150.
Product prices are set up so they include VAT (21%).
VAT is removed when orders are shipped outside the Netherlands.
In most scenarios shipping cost calculation is not a problem but there is one VAT-related  specific scenario where it is not working.</p>

<p>Let's begin with the scenario that works as expected: </p>

<p>1) User buys product(s) which include VAT and the total order amount is  €151. Shipping address is inside EU so he is correctly eligible for free shipping.</p>

<p>Now lets go to the scenario where it does not work:</p>

<p>2) User buys the same product(s) as above and the total order amount is again €151. User is again eligible for free shipping but this time shipping is outside the Netherlands. That means that VAT is being excluded and therefore the final amount that user has to pay is below €150 and therefore he should pay for the shipping. But this is not happening.</p>

<p>It seems that system reads the 'total order price' as the total amount of the order before the tax reduction is applied. Therefore, according to the system user is eligible for free shipping. Though this is not correct.</p>

<p>My question is: Is there any way to make system look at the "final" total amount so the shipping calculation is correct?</p>

CC BY-SA 4.0
2018-06-22T11:22:41.267Z
commerce 1 or 2?
Luke Holder
CC BY-SA 4.0
2018-07-12T11:26:06.457Z
commerce 1, craft 2
boldenamsterdam
<plugin-craftcommerce><plugins><shipping><tax>
Craft Commerce Shipping Total Order Price rule
# Craft Commerce Shipping Total Order Price rule

(Asked by: username_0 on 2018-06-20)

I have a webshop where you can get free shipping when the minimum total order price is €150.
Product prices are set up so they include VAT (21%).
VAT is removed when orders are shipped outside the Netherlands.
In most scenarios shipping cost calculation is not a problem but there is one VAT-related specific scenario where it is not working.

Let's begin with the scenario that works as expected:

1) User buys product(s) which include VAT and the total order amount is €151. Shipping address is inside EU so he is correctly eligible for free shipping.

Now lets go to the scenario where it does not work:

2) User buys the same product(s) as above and the total order amount is again €151. User is again eligible for free shipping but this time shipping is outside the Netherlands. That means that VAT is being excluded and therefore the final amount that user has to pay is below €150 and therefore he should pay for the shipping. But this is not happening.

It seems that system reads the 'total order price' as the total amount of the order before the tax reduction is applied. Therefore, according to the system user is eligible for free shipping. Though this is not correct.

My question is: Is there any way to make system look at the "final" total amount so the shipping calculation is correct?

**Tags:** plugin-craftcommerce, plugins, shipping, tax

> **Comments:**
> **username_1**: commerce 1 or 2?  
> **username_0**: commerce 1, craft 2  

---

## 1 answers

### Answer by username_1 on 2018-07-23. Score: 1

The current rule for the total in Commerce 1 is in craft/plugins/commerce/models/Commerce_ShippingRuleModel.php starting at line 214: 
if ($this->minTotal && $this->minTotal > $order->itemTotal)
{
    return false;
}
if ($this->maxTotal && $this->maxTotal <= $order->itemTotal)
{
    return false;
}

Try changing it to use totalPrice and see if that resolves the issue for you:
if ($this->minTotal && $this->minTotal > $order->totalPrice)
{
    return false;
}
if ($this->maxTotal && $this->maxTotal <= $order->totalPrice)
{
    return false;
}

If we were to go ahead and change it in core, it would be a breaking change for other users. The only way around that is to make a new setting.
If it resolves the issue for you, I will look into making the new setting.

> **Comments:**
> **username_2**: Is there any plan to add this setting? We have a situation where we want the shipping to apply after the discount.  

---

