At Magavenue we regularly the same questions by email. That is why we will take some questions on the blog, to provide a clearer explanation.

One such issue is the following:

"How about PrestaShop, to apply for free shipping to one country? or to only one carrier? "

Indeed the question is insightful, if ever a trader decides to use the calculation of shipping costs by weight and not by the price, then it is not possible to separate areas, or carriers, to offer fresh port.
It finds himself confronted with a problem:

-either we use a calculation of shipping costs by the price. But you can have the problem of a heavy object not very expensive or very expensive object, not very heavy. It remains to hope that the average of the two ... well, this is not necessarily the ideal solution for all.

-either you offer 50 € shipping, but you should offer some or the area where the customer is located, or the carrier used.

In short, a simple solution exists. Unfortunately it is to change one of Prestashop class. In general we can get around by a module, but here it would be too complicated. Therefore we advise you not to put it in place.

If you choose to achieve it, think before making any changes, to make a complete backup of your shop, and above all keep a history of the files you've changed for a possible update.

We speak for PrestaShop 1.3.1, the modification can be applied to earlier versions, it will just be careful where you go and place the code.

In Cart.php file in the Classes folder. You will have around line 833 the following code:

if ($ orderTotalwithDiscounts> = floatval ($ free_fees_price) AND floatval ($ free_fees_price)> 0)
return $ shipping_cost;

Clearly, if the total amount of the order (with the coupon included) exceeds the amount of carriage paid, then we offer the shipping cost (at that time $ shipping_cost = 0).

We'll just edit this line as follows:

if ($ orderTotalwithDiscounts> = floatval ($ free_fees_price) AND floatval ($ free_fees_price)> 0 AND intval ($ zone_id) == 6)
return $ shipping_cost;

Here we ask what the postage is offered only if the delivery area is 6 (in our example we have created a specific area whose identifier is 6.

You can also limited to one carrier in the following manner:

if ($ orderTotalwithDiscounts> = floatval ($ free_fees_price) AND floatval ($ free_fees_price)> 0 AND intval ($ id_carrier) == 2)
return $ shipping_cost;

Of course it would be possible to make a module to configure directly from the back office, to which carrier or which area we want to offer the shipping cost. To be continued…

21 comments why not let yours?

We do not bring support for comments for a technical problem with one of our modules. Thank you to contact us directly with our contact form!

Tuto perfect! Thank you !

Cosmetics man April 29, 2014 at 9 am 52 min

nickel! Thank you

vince April 25th, 2014 at 9 am 10 min


We have proposed a simple solution for a normal user can put it online.

If a claimant had to do this operation, then yes, it should use a configuration or research rather than the id of crude.

Magavenue October 26th, 2012 at 10 am 22 min

Hi everybody,

the problem (it's not the method but the problem prestashop ... again) is that when editing a carrier then its id_carrier changes.
It is therefore not a reliable solution if that administers the site is not the webmaster as this may invalidate any free transportation if the administrator for example want to change the logo or other carrier.

Unless I'm wrong ...

Mathix October 4, 2012 to 15 hours 23 min


Thank you for the tutorial, but I tried in the version, but my page no longer works FO side, I wanted to know if we had the same command or not?

Thank you in advance for your assistance.

Best regards

POUPET July 14, 2012 to 13 h 53 min

To write a comment