Get Free Audit

Zone-Based Shipping Limitations and Choices in Prestashop

Jun 18, 2014

1291 Alex Simonchik

Zone-Based Shipping Limitations and Choices in Prestashop

We continue the series of our articles which aim to help our forum users and today we’ll describe how to make a free delivery not only for the entire store but even for a specific zone.  This question was submitted by the user “B. Köring”:

I need help to configure shipping in ps 1.5.6.2. I ‘d even hire some help if you sent me a reasonable charge and I hope I am allowed to aks this here. But I am looking for help since 3 months now and I do not have a solution. Mainly I asked in the Geman forum but now I try it here.

Presta is set up to calculate the shipping by price threshhold – not by weight at the moment. So I can advertise to offer free shipping when customers buy for 40 €.

The problem is that we ship to Eurozone and when customers buy for 41 € shipping will be free – as intended. That is ok. But it is not okay if this order weighs some kilos! Because then we would have to pay a high fee – e.g. 20 € for 8 kilos or so. You see, we would make minus.

So I need to a possibility to make Prestashop skip the ‘free shipping – variable’-condition when shippment zone is not ‘standard-zone’.

Is this possible via vanilla Prestashop, a drity hack, or could this be easily done via a module where you check mark the zones that shall have NO free shipping condition?

Default PrestаShоp settings allow you to set up free delivery only for the entire store:

Zone-Based Shipping Limitations and Choices in Prestashop

First off, we need to expand the table ps_carrier to keep the data separately for each carrier. Let’s make an SQL-query which will add 2 new fileds: shipping_free_price and shipping_free_weight:


To control the new fields you need to override the class Carrier (classes/Carrier.php) and the file AdminCarrierWizardController of the controller (controllers/admin/AdminCarrierWizardController.php).

Let’s add new fields to the Carrier class. For that we add the file Carrier.php into the folder override/classes/Carrier.php with the following code:


In order to add the ability to change settings via the backend, let’s add new fields to the controller AdminCarrierWizardController: add the file AdminCarrierWizardController.php into the folder override/controllers/ AdminCarrierWizardController.php with the following content:

Andrey_Dubina
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey


Zone-Based Shipping Limitations and Choices in Prestashop

Now we need to add the logic to perform the basic task, that is, to verify the potential possibility of free delivery when selecting a carrier at the checkout step.  For that we need to override the Cart class, namely the function getPасkаgeShippingCоst. Let’s create the file override/classes/Cart.php and change the behavior of the function:

Andrey Dubina
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Andrey

11 Comments

  1. Hi Iryna,

    In the tutorial the following steps say:
    “For that we add the file Carrier.php into the folder override/classes/Carrier.php with the following code:”
    &
    “add the file AdminCarrierWizardController.php into the folder override/controllers/ AdminCarrierWizardController.php with the following content:”
    & also
    “Let’s create the file override/classes/Cart.php and change the behavior of the function:”

    To me it’s not clear, do we override the code in the original file that we copied or do we add the code to the files of these steps?

    Thanks for your comment.

  2. Dear Lucas,

    could you please add some details? I’m afraid I don’t catch what exactly you mean.

  3. Hi,

    Do we need to clear the contents and change it by the listed code for the files or do we need to add code?

  4. Hello,

    I’ve changed the files and database like in the article but it gives “error”

    Can you help?

  5. HFriday,

    Most probably you have made some mistake. We can help you to install this on your store, please, contact our support team at [email protected] to get some help.

  6. Yes, this is what I need but after trying this in PS 1.6.0.8 it ‘kills’ my shop. Also I’m missing some hints on what I should be able to configure where after applying these changes…

    Hope you can help out!

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *