In Magavenue we regularly the same questions by e-mail. That is why we will resume 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? "dropoff Window

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 postage by the price. But you will 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 must offer some or the area where the customer is located, or used carrier.

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

If you choose to make, think before making any changes, to perform a full backup of your shop, and above all keep a history of files 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 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 freight prepaid, 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 ($ field_id) == 6)
return $ shipping_cost;

Here we ask what the postage 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 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 set directly from the Back Office, to which carrier or which area we want to offer the shipping cost. To be continued ...

Key words:

, , ,

21 comments why not leave yours?

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

Mathix,

We have proposed a simple solution for a normal 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 id crude.

Magavenue October 26, 2012 at 10 am 22 min

hi all,

the problem (this is 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 cancel any free transportation if the administrator want for example to change the carrier logo or other.

Unless I'm wrong ...

Mathix October 4, 2012 At 15 h 23 min

Hello,

Thank you for the tutorial, but I have tried in the 1.4.7.3 version, but my page not working FO hand, I wanted to know if we had the same command or not?

Thank you in advance for your help.

Best Regards

POUPET July 14, 2012 At 13 h 53 min

Write a comment