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

One of these issues is as follows:

"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 and not by the price, it is then 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 only 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 need to offer some or the area where the customer or the carrier used.

In short, a simple solution exists. Unfortunately it is to change the class of PrestaShop. In general we can bypass a module, but here it would be too complicated. This is why we do not recommend to put in place.

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

We speak for Prestashop 1.3.1, the modification can be applied 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 coupon included) exceeds the amount of the postage, then we offer shipping (at the 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 that the shipping is available 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 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 offer the postage. To be continued ...

Keywords:

, , ,

21 comments why not leave yours?

We will not make a comment supporting a technical problem with one of our modules. Thank you 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 minutes

Mathix,

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

If a claimant should have to do this, then yes, he should use a configuration or research rather than 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 change.
It is therefore not a reliable solution if that administers the site is not the webmaster as this may cancel any free transport if the administrator want to change for example the logo of the carrier or another.

Unless I'm wrong ...

Mathix October 4, 2012 At 15 h 23 min

Hello,

Thank you for the tutorial, but I tried in the 1.4.7.3 version, but my page does not work FO side, I wanted to know if it was the same order or not?

Thank you in advance for your help.

Kind regards

POUPET July 14, 2012 At 13 h 53 min

Write a comment