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 about Prestashop , to apply free shipping to a single 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, then it is not possible to separate areas or carriers, to offer fresh port.
It finds himself confronted with a problem:

-We use a calculation is shipping the prize. But you can have the problem of a heavy object not very expensive, or object very expensive, 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 provide 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 make, think before making any changes, to perform a full backup of your shop and especially keep a history file that you modified 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 to put the code.

In the file Cart.php contained in the Classes folder. You 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 the postage, so we offer free 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 what the postage 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, which carrier or any area we want to offer the postage. To be continued ...

Keywords:

, , ,

19 comments why not leave yours?

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

Mathix,

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

If a claimant was going to do this, then yes, he should use a configuration or research rather than gross id.

Magavenue October 26, 2012 at 10 h 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 change.
This is 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 eg change the logo or other carrier.

Unless I'm wrong ...

Mathix October 4, 2012 At 15 h 23 min

Hello,

Thank you for the tutorial, but I tried on version 1.4.7.3 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.

Cordially

POUPET July 14, 2012 at 13 h 53 min

Thank you for this tutorial!

Abdeslam 23 May 2012 at 10 h 09 min

Hello Alain,

For the moment, nothing planned. But you can contact us for a quote.

Magavenue February 29, 2012 at 11 am 50 min

Write a comment