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 of these issues is as follows:

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

In fact 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 therefore not possible to separate areas or carriers, to offer fresh port.
The reader is then confronted with a problem:

-Or 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 ... in short, 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 one class of Prestashop. In general we can bypass a module, but here it would be too complicated. That is why we recommend you to put in place.

If you choose to perform, think before making any changes, to perform a full backup of your store, and especially keep a history file that you 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 to put the code.

In Cart.php file in the Classes folder. You around the 833 line 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 the carriage, so 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 ($ field_id) == 6)
return $ shipping_cost;

Here we ask that the shipping is available only if the delivery area is equal to 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, what carrier or what area we want to offer the postage. To be continued ...

Keywords:

, , ,

21 comments why not leave yours?

We will not implement support for comments for 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 min

Mathix,

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

If a claimant should have to do this, then yes, you should use a 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 ... once 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 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

Hello there,

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 we had the same control or not?

Thank you in advance for your help.

Best regards

POUPET July 14, 2012 At 13 h 53 min

Write a review