In Magavenue we regularly the same questions by e-mail. That is why we will take some questions on the blog, to provide a clearer explanation.

One such issue is the following:

"How on Prestashop , to apply free shipping to one country? or only one carrier? "

Indeed the question is insightful, if ever a trader decides to use the calculation of shipping costs by weight, not the price, it is therefore not possible to separate areas, or carriers, to offer fresh port.
The reader is then 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 shipping to 50 €, but you will have to offer some or the area where the customer or the carrier used.

In short, a simple solution exists. Unfortunately it is to change one of the class of PrestaShop. In general we can get around by a module, but here it would be too complicated. That's why we do not recommend putting it in place.

If you choose to perform, think before making any changes, to perform a full backup of your shop, and especially to keep a history of the files you've changed for a possible update.

We speak for Prestashop 1.3.1, the modification may apply to older 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 833 online 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 the postage, so we offer the shipping cost (at that time $ shipping_cost = 0).

We'll just change 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 shipping is available only if the delivery area is 6 (in our example we have created a specific area with the ID 6.

See also limited to a single carrier as follows:

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 set directly from the back office to which carrier or which area we want to provide postage. To be continued ...


, , ,

21 comments why not leave yours?

We will not implement support for review by a technical problem with one of our modules. Thank you to contact us directly with our contact form !

Perfect tutorial! Thank you!

Cosmetics man April 29, 2014 at 9 am 52 min

nickel! thank you

Province April 25, 2014 at 9 am 10 min


We proposed a simple solution to an average user can put it online.

If a claimant had to have to do this, then yes, he should use configuration or research rather than the raw id.

Magavenue October 26, 2012 at 10 am 22 min

hi to all,

the problem (this is not the method but the problem prestashop ... again), is that when you edit a carrier then its id_carrier changes.
It is therefore not a reliable solution if the one who administers the site is not the webmaster as this may invalidate any free transport if the administrator wants to change the logo, for example, the carrier or another.

Unless I'm wrong ...

Mathix October 4, 2012 At 15 h 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 help.

Kind regards

POUPET July 14, 2012 At 13 h 53 min

Write a comment