Prestashop: Unexpected behaviour with shipping price. It's free until payment (with any carrier). But shipping cost is correct after payment. Found the fix but it's also very strange.

Created on 3 Jan 2019  路  11Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
When you add something to cart - shipping is always free even if carrier is not free shipping.

image

next step..

image

Only when you confirm the order you see actual shipping cost and final price:

image

In this way my shop is not client-oriented :)

So I found the place where the shipping cost is calculating. https://github.com/PrestaShop/PrestaShop/blob/65dfa13e3876d711ed8e2779fedef89cdbaa08dc/classes/Cart.php#L3250

I decide to create a FileLogger and check which price is calculating. Then I opened a logfile and saw expected result. Then I open a cart and shipping was NOT FREE. I fixed it!
image

image

I have commented FileLogger lines and shipping cost was Free again..

I try to log shipping cost by myself with file_put_contents with FileLogger and get expected result:
image
image

I have commented FileLogger lines and my own log writes all zeros:
image

I tried to find out what FileLogger (https://github.com/PrestaShop/PrestaShop/blob/0d53d6b58b951ac364ad44671cf1ae9bf7ab6aed/classes/log/FileLogger.php) do with given arguments and got nothing. It just writes the message to specific file without any transformation or something else.

So how does it works with this dumb fix? And why shipping cost appears in such a strange way without it? I see that people have the same problem and no one have solved it.
For instance: https://www.prestashop.com/forums/topic/640460-where-to-change-text-for-free-shipping-prestashop-1724/#comment-2874066

Additionnal information
PrestaShop version: 1.7.5
PHP version: 7.3

1.7.5.0 Bug Carriers FO No change required Shopping carts

Most helpful comment

Hi @khouloudbelguith

I downgraded version of PHP from 7.3.0 to 7.2.13 and it works fine without any fixes.

All 11 comments

Hi
This is strange. In my shop the shipping cost is displayed as soon as a product is added to cart:
image
Do you use a contrib shipping module for DHL or did you just set it up in the Carriers page? If it's a module, then the problem is with the module and not Prestashop core and you should contact the module developer.

HI @Kharabet,

In my case, I did not manage to reproduce the issue with PS1.7.5.0 & PS1.7.4.4.
As @rdy4ever said, did you use any custom module for your carrier?
Thanks!

Hi @rdy4ever

I use embeded shipping module which i get from this repo with Prestashop. It's just a carrier which I did set up in BO with DHL logo.
This is out of the box prestashop. I didn't make any changes in code, except some css.

Hi @khouloudbelguith ,

I had the same problem earlier with PS 1.7.4.x and then I decide to upgrade to PS 1.7.5 and problem was not solved. Then I reinstall PS from scratch and still get problem with shipping price.

I didn't use any custom carrier module. Only embeded in prestashop carrier module. It's the only carrier from my BO and it's not free shipping.
Thank you!

@Kharabet, in your BO => Shipping => Preferences, what is the carrier by default?
Thanks!

@khouloudbelguith ,
image

image

As I said, this is the only carrier. So prestashop has no choice. The shipping price have to be not free.

@Kharabet, We need to retrieve the PHP error log and the debug mode report in order to find out what's wrong.
Don't you know how to get this information? Please read the following article:
http://build.prestashop.com/howtos/misc/how-to-create-bug-report/

Thanks!

Hi @khouloudbelguith

I downgraded version of PHP from 7.3.0 to 7.2.13 and it works fine without any fixes.

Hi @Kharabet,

Thanks for your feedback.
I close the issue, feel free to open a new one when needed.
Thanks!

Hi @khouloudbelguith

Thank's a lot !!! PHP 7.2 and it works great !

Many thanks !

I have similar problem with php 7.2.33 and ps 1.7.6.6, sometimes customers tells me that cart show free shipping but we don't have any free shipping option

Was this page helpful?
0 / 5 - 0 ratings