Zone-Based Shipping Limitations and Choices in Prestashop

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:

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:



7 comments

  1. 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!

  2. HFriday,

    Most probably you have made some mistake. We can help you to install this on your store, please, contact our support team at store@belvg.com to get some help.

  3. Hello,

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

    Can you help?

Post a new comment

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