Jump to content
Shipsworld

Where to change text for Free Shipping? [PrestaShop 1.7.2.4]

Recommended Posts

Where are the translations located for the word "Free" in the Ajax Cart and on the Checkout pages.
Looked everywhere, but I could not find it.
How to change "Free" to something else, and keep this when upgrading?

Thanks for the help.
 

Version used of PS: Prestashop 1.7.2.4 (stable branche, or so they say...)

PrintScreen002.jpg

PrintScreen003.jpg

Share this post


Link to post
Share on other sites

Anyways, I've looked myself for all the files that had the text (including single quotes) 'Free' in it.
My tool (Turbo Searcher, old tool) finds the following files as a result:
 

\classes\checkout\DeliveryOptionsFinder.php
\controllers\admin\AdminPatternsController.php
\controllers\admin\AdminReturnController.php
\src\Adapter\Cart\CartPresenter.php
\src\Adapter\Order\OrderPresenter.php
\app\cache\prod\translations\catalogue.en-US.3fea97234267aa02290eee8ee5357fb280cfa275.php
\app\cache\prod\translations\catalogue.en-US.8739602554c7f3241958e3cc9b57fdecb474d508.php
\modules\gwadvancedinvoice\controllers\admin\AdminGwadvancedinvoiceconfigController.php
\adminxx\autoupgrade\latest\classes\checkout\DeliveryOptionsFinder.php
\adminxx\autoupgrade\latest\controllers\admin\AdminPatternsController.php
\adminxx\autoupgrade\latest\controllers\admin\AdminReturnController.php
\adminxx\autoupgrade\latest\src\Adapter\Cart\CartPresenter.php
\adminxx\autoupgrade\latest\src\Adapter\Order\OrderPresenter.php
\adminxx\themes\default\template\controllers\carrier_wizard\summary.tpl
\adminxx\themes\default\template\controllers\modules\list.tpl
\adminxx\themes\default\template\controllers\modules\tab_module_line.tpl
\adminxx\themes\default\template\helpers\form\form.tpl
\src\PrestaShopBundle\Resources\views\Admin\Module\Includes\card_grid.html.twig
\src\PrestaShopBundle\Resources\views\Admin\Module\Includes\modal_read_more_content.html.twig
\vendor\doctrine\dbal\lib\Doctrine\DBAL\Platforms\Keywords\DB2Keywords.php
\vendor\doctrine\dbal\lib\Doctrine\DBAL\Platforms\Keywords\DrizzleKeywords.php
\adminxx\autoupgrade\latest\adminxx\themes\default\template\controllers\carrier_wizard\summary.tpl
\adminxx\autoupgrade\latest\adminxx\themes\default\template\controllers\modules\list.tpl
\adminxx\autoupgrade\latest\adminxx\themes\default\template\controllers\modules\tab_module_line.tpl
\adminxx\autoupgrade\latest\adminxx\themes\default\template\helpers\form\form.tpl
\adminxx\autoupgrade\latest\src\PrestaShopBundle\Resources\views\Admin\Module\Includes\card_grid.html.twig
\adminxx\autoupgrade\latest\src\PrestaShopBundle\Resources\views\Admin\Module\Includes\modal_read_more_content.html.twig
\adminxx\autoupgrade\latest\vendor\doctrine\dbal\lib\Doctrine\DBAL\Platforms\Keywords\DB2Keywords.php
\adminxx\autoupgrade\latest\vendor\doctrine\dbal\lib\Doctrine\DBAL\Platforms\Keywords\DrizzleKeywords.php


Now, can somebody please tell me -->
Which of the above files need to be modified for this textual change on the whole website (from 'Free' to: 'On Invoice')? (see screenshots from earlier on!!)

Edited by Shipsworld
  • Like 1

Share this post


Link to post
Share on other sites

Hey Shipsworld!  Did you ever find an answer for this question?  This used to be easy on 1.6 but now with all the partials I can hardly find anything. Add to that the loss of the Front Office Translation section and I dislike 1.7 more each time I work with it.  

 

 

Edited by AZHosting

Share this post


Link to post
Share on other sites

I found it. It's in src/Adapter/Cart/CartPresenter.php and makes reference to the translator for Shop>Theme>Checkout>Free but there isn't one.  So this is a bug with may be fixed in some upcoming version. Just change 'Free' to something like 'Not Calculated' and you should be good to go until there is an upgrade path for 1.7.  Probably see it being upgradable around 1.7.49 or so.  No worries for the time being.

src/Adapter/Cart/CartPresenter.php

        $subtotals['shipping'] = array(
            'type' => 'shipping',
            'label' => $this->translator->trans('Shipping', array(), 'Shop.Theme.Checkout'),
            'amount' => $shippingCost,
            'value' => $shippingCost != 0
                ? $this->priceFormatter->format($shippingCost)
                : $this->translator->trans('Free', array(), 'Shop.Theme.Checkout'),
        );

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Thank you AZHosting.

This has always been a pain for me, even on previous releases.

Your solution does not fix the issue, but sure helps to prevent misunderstandings.

Share this post


Link to post
Share on other sites

That solution didn't work for me, so I have just hidden it using css

div#cart-subtotal-shipping.cart-summary-line {
    display:none;
     }

Share this post


Link to post
Share on other sites

This is a question from year 2012 until 2018, no one can solve it.  I think Prestashop does this on purpose so we have to buy a module to fix this problem.  This is a very serious issue yet no one can fix it and Prestashop doesn't bother too.

Imagine people buying your products, it always says free shipping then when they want to check out, the shipping cost appears.  The clients feel defeated and never comes back to our shop.

Share this post


Link to post
Share on other sites

I had the same problem but found out that it is a result of the carrier setting and the way the carrier options are set.

I have set them as follows: default carrier: best quality, sort: on price, sorting: ascending. 

Best way to test is to use 2 tabs in your browser: one showing the cart with a product added and one with the bakc office settings and just play around with the settings. SAve the setting and update the screen with the cart to see the change (switch of the cache and empty cache and force compilation to see the actual new data).

Before I found this out I also looked for removing or changing the wording on "Free" in the Cart.  I good way to find out is to store a back up of the shop on your own harddisk and use Notepad++ to search through all the files for the word "Free".  This will produce a lost of the files and you van proceed from there.

I use notepad++ a lot to find translations as the new PS version does not make it easy to found out where the field us you want to change.

I just the similar way to remove the line from the pop-up screen after you add a product to the cart.

  • Like 1

Share this post


Link to post
Share on other sites
On 9/3/2018 at 10:10 AM, AZHosting said:

I found it. It's in src/Adapter/Cart/CartPresenter.php and makes reference to the translator for Shop>Theme>Checkout>Free but there isn't one.  So this is a bug with may be fixed in some upcoming version. Just change 'Free' to something like 'Not Calculated' and you should be good to go until there is an upgrade path for 1.7.  Probably see it being upgradable around 1.7.49 or so.  No worries for the time being.

src/Adapter/Cart/CartPresenter.php


        $subtotals['shipping'] = array(
            'type' => 'shipping',
            'label' => $this->translator->trans('Shipping', array(), 'Shop.Theme.Checkout'),
            'amount' => $shippingCost,
            'value' => $shippingCost != 0
                ? $this->priceFormatter->format($shippingCost)
                : $this->translator->trans('Free', array(), 'Shop.Theme.Checkout'),
        );

 

 

THANKSSSSSS!!!!!!!!!!!!! I LOVE YOU

Share this post


Link to post
Share on other sites
On 5/25/2018 at 7:16 AM, Frevab said:

I had the same problem but found out that it is a result of the carrier setting and the way the carrier options are set.

I have set them as follows: default carrier: best quality, sort: on price, sorting: ascending. 

Best way to test is to use 2 tabs in your browser: one showing the cart with a product added and one with the bakc office settings and just play around with the settings. SAve the setting and update the screen with the cart to see the change (switch of the cache and empty cache and force compilation to see the actual new data).

Before I found this out I also looked for removing or changing the wording on "Free" in the Cart.  I good way to find out is to store a back up of the shop on your own harddisk and use Notepad++ to search through all the files for the word "Free".  This will produce a lost of the files and you van proceed from there.

I use notepad++ a lot to find translations as the new PS version does not make it easy to found out where the field us you want to change.

I just the similar way to remove the line from the pop-up screen after you add a product to the cart.

OMG thank you.

 

I found it under translations>theme>checkout

Share this post


Link to post
Share on other sites

total remove the shipping from cart

themes\classic\modules\ps_shoppingcart\modal.tpl

remove :

              <p><strong>{l s='Total shipping:' d='Shop.Theme.Checkout'}</strong>&nbsp;{$cart.subtotals.shipping.value} {hook h='displayCheckoutSubtotalDetails' subtotal=$cart.subtotals.shipping}</p>
 

+ css

div#cart-subtotal-shipping.cart-summary-line {
    display:none;
     }

Share this post


Link to post
Share on other sites
On 3/9/2018 at 5:10 PM, AZHosting said:

I found it. It's in src/Adapter/Cart/CartPresenter.php and makes reference to the translator for Shop>Theme>Checkout>Free but there isn't one.  So this is a bug with may be fixed in some upcoming version. Just change 'Free' to something like 'Not Calculated' and you should be good to go until there is an upgrade path for 1.7.  Probably see it being upgradable around 1.7.49 or so.  No worries for the time being.

src/Adapter/Cart/CartPresenter.php


        $subtotals['shipping'] = array(
            'type' => 'shipping',
            'label' => $this->translator->trans('Shipping', array(), 'Shop.Theme.Checkout'),
            'amount' => $shippingCost,
            'value' => $shippingCost != 0
                ? $this->priceFormatter->format($shippingCost)
                : $this->translator->trans('Free', array(), 'Shop.Theme.Checkout'),
        );

 

 

This file is deprecated in 1.7.4 and up.

The new file to modify is:

src/Adapter/Presenter/Cart/CartPresenter.php

Delete code AZHosting wrote above and get rid of this "free" shipping costs

Share this post


Link to post
Share on other sites

Hi everyone!

After about 3 hours of playing around, found a solution!!

In the database there is a table called "translation"

I added there a row with my translation, please see screenshot attached.

clear cache (Advanced Parameters -> Performance -> clear cache)

In my case I wanted to translate "Free" to Hebrew, and I think the reason it wasn't showing in the BO translation system (in Shop->theme->checkout) is because the translation for that word is coming from the language package of Hebrew.

So I guess adding the row in the database overrides the file of the translation package.

If this is true, it's bad on PS side for not giving an option to easily change package translation.

 

Screenshot 2019-04-02 17.21.04.png

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More