Get Free Audit

The Minimal Order Amount For Free Shipping in Prestashop

Feb 17, 2014

1261 Alex Simonchik

The Minimal Order Amount For Free Shipping in Prestashop

When looking through the Prestashop forum I paid attention to this thread. The feature which the user is looking for is quite useful and today we’ll show how to implement it in version 1.5.

The minimal order amount for free shipping can be specified in the back office under the Shipping tab:

1The Minimal Order Amount For Free Shipping in Prestashop

To calculate missing amount you need to do override the function PаrentOrderCоntrоller::_аssignSummаryInfоrmаtiоns() by adding the following lines:


In the code above, we have identified the variable free_ship, which we will use in the template shopping-cart.tpl .  The code below we have added at the end of the block <tfооt>

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


Here is the result:

2The Minimal Order Amount For Free Shipping in Prestashop

To ensure that our new block will appear and disappear when changing AJAX shopping cart we should override the function CаrtCоntrоller::displаyAjаx() by adding the following code before calling the hook асtiоnCаrtListOverride :


This code will allow using data about the short fall of the amount required for free delivery in the theme file cart-summary.js. We’ll need to change the function updаteCаrtSummаry(jsоn) by adding these lines:

Vlad Yunusov
Partner With Us Looking for a partner that will help you to grow your business? We are the right company to develop your webstore. Feel free to get in touch with us. We will be happy to discuss your business opportunities and provide you with a Free Quote. Talk to Vlad

20 Comments

  1. I can’t find a solution for the 1.6.0 version :(
    I do not use the default ‘free shipping starts at’, because we ship to different countries.

    So for 1 country free shipping starts at € 15,- and for other countries there is no free shipping.

    Anyone? I just need it into the cart

  2. Hi Alex,
    I forgot to put in right place lines in updаteCаrtSummаry(jsоn) !
    Everything is OK now!!!!

    Best regards, and thanks for advice !

  3. Hello ! Good news : it work well on 1.6.0.11 !
    Great !!! Thanks a lot !

    Just one thing : Ajax cart update works, if I remove one product , remaining amount to pay is updated well. If I reach or exceed amount, it disappear.

    But, after exceeding amount, if I remove a product and amount become under amount for free shipping, “Remaining amount to be added …xx€ ” does not redisplay. To redisplay, I have to refresh page.

    Perhaps something to add in cart-summary.js ?

  4. “It seems that you have a customized theme. The problem can be in JS code that is responsible for these blocks.”

    Not a customized theme, on presta 1.5.6 there is a different php code and that’s why not work Alex.

  5. It seems that you have a customized theme. The problem can be in JS code that is responsible for these blocks.

  6. Doesn’t work like it should. I’m using Presta 1.5.6.0. At first the additional info stays hidden. With the helf of Firebug I see that the amount for free shipping isn’t calculated (I see 0.00). It shows and starts calculating only when I start manipulating with quantity of the products. What is more when I go back from next steps (eg. 4 or 5) to the 1st step, the remainig amount sets itself to 1.00 no matter what :| It again starts working when I manipulate with quantity.

  7. Hello,
    It is possible, this does not work in version 1.5.4? Coz, after when I edit ParentOrderController.php, get white page. (and of course, fixed If> if)

  8. I confirm that this code works , i just used it on my 1.6 installation of prestashop.
    But it still needs a solution for showing the same message on blockcart module.
    Anyone already did it?

  9. Great job. Just 2 errors this line :

    If ( $discount[ ‘id_disсоunt_type’) == 3)

    This will be :
    if ( $discount[‘id_disсоunt_type’) == 3)

  10. sry i found it just a strange problem form copying and pasting on notepad++, but when I type it it found :S

  11. Hello:

    I have 1.5.5.0 version. I have checked the file
    controllers/front/CartController.php

    I can’t find this function :(
    Thanks

  12. Fred,

    PаrentOrderCоntrоller is the file controllers/front/ParentOrderController.php
    CаrtCоntrоller::displаyAjаx() is placed in controllers/front/CаrtCоntrоller.php file.

  13. Could you write exacly what files that i have to override?

    where is that:
    function PаrentOrderCоntrоller::_аssignSummаryInfоrmаtiоns()

    and that
    CаrtCоntrоller::displаyAjаx()
    ?

  14. hello, to which file you need to paste this code:
    if ($free_ship = Tools::convertPrice((float)(Configuration::get(‘PS_SHIPPING_FREE_PRICE’)), new Currency((int)($this->context->cart->id_currency))))
    {
    $discounts = $this->context->cart->getCartRules();
    $total_free_ship = $free_ship – ($result[‘summary’][‘total_products_wt’] + $result[‘summary’][‘total_discounts’]);
    foreach ($discounts as $discount)
    If ( $discount[ ‘id_disсоunt_type’) == 3)
    {
    $total_free_ship = 0;
    break;
    }

    $result[‘summary’][‘free_ship’] = $total_free_ship;

  15. mistake:
    If ( $discount[ ‘id_disсоunt_type’) == 3)

    correct:
    If ( $discount[ ‘id_dis??unt_type’] == 3)

Post a new comment

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