RichNAS Posted January 10, 2020 Share Posted January 10, 2020 Hi All, I have been searching for a solution to remove the shipping from the cart on Prestashop 1.7 it seems like a common issue people are having but with no resolution. I do not want to show customers any shipping price until the get to the shipping method section of the checkout. This is because i offer multiple couriers with different speed rates and different costs depending on location etc, at the minute it shows free and when a customer begins to checkout the shipping cost is a surprise for them. I have attached some images of exactly what i mean. I hope someone can help me fix this issue that should be a standard option in Prestashop. Thanks Link to comment Share on other sites More sharing options...
Mole Sounds Posted March 15, 2020 Share Posted March 15, 2020 I have the same issue. Any results? Link to comment Share on other sites More sharing options...
ComGrafPL Posted May 5, 2020 Share Posted May 5, 2020 Same. Looking forward for solution. Link to comment Share on other sites More sharing options...
Guest Posted May 5, 2020 Share Posted May 5, 2020 Default is to select a carrier with a price greater than 0 in the carrier configuration. You need to edit 4 tpl templates and comment out the shipping. Link to comment Share on other sites More sharing options...
RichNAS Posted May 6, 2020 Author Share Posted May 6, 2020 18 hours ago, Guest said: Default is to select a carrier with a price greater than 0 in the carrier configuration. You need to edit 4 tpl templates and comment out the shipping. do you know which 4 tpl files it would be? Thanks in advance Link to comment Share on other sites More sharing options...
Guest Posted May 6, 2020 Share Posted May 6, 2020 1. ./themes/classic/modules/ps_shoppingcart/modal.tpl find and change to: <!--<p><span>{l s='Shipping:' d='Shop.Theme.Checkout'}</span> <span class="value">{$cart.subtotals.shipping.value} {hook h='displayCheckoutSubtotalDetails' subtotal=$cart.subtotals.shipping}</span></p>--> 2. ./themes/classic/templates/checkout/_partials/cart-detailed-totals.tpl find and change to: <div class="cart-summary-line" id="cart-subtotal-{$subtotal.type}" {if $subtotal.type === 'shipping'}style="display:none;"{/if}> etc... Link to comment Share on other sites More sharing options...
Verlonimo Posted May 7, 2020 Share Posted May 7, 2020 @Guest You are providing wrong solution to topic author. This will hide shipping cost completly. Topic author wants to hide shipping cost until shipping step is reached... Thanks Link to comment Share on other sites More sharing options...
RichNAS Posted May 7, 2020 Author Share Posted May 7, 2020 Hi, thank you for your help but as Verlonimo states that would completely hide the shipping cost from my customer. I just want to hide it until they get to the carrier selection Regards Rich 1 Link to comment Share on other sites More sharing options...
Verlonimo Posted May 7, 2020 Share Posted May 7, 2020 @RichNAS I will do same modification to my checkout i am working on soon and will try to provide solution here. However, this require some research and is not just show/hide which could be done easy with assigning some vars probably... The biggest issue is that you also want yout Total to be adjusted correspondingly based on if shipping price is showing or not. So it won't be misleading to the users. Thanks Link to comment Share on other sites More sharing options...
Guest Posted May 7, 2020 Share Posted May 7, 2020 (edited) Quote Hi All, I have been searching for a solution to remove the shipping from the cart on Prestashop 1.7 it seems like a common issue people are having but with no resolution. I do not want to show customers any shipping price until the get to the shipping method section of the checkout. Code 1. = image 2 Code 2. = image 1 image 3 and image 4, There is no standard 5 step order in Prestashop 1.7, so you can't advise. If you put the codes where I wrote, you would see a change. But you can add another condition to code 2. for which pages the code will be valid. {if $subtotal.type === 'shipping' && $page.name === 'cart'}style="display:none;"{/if} Edited May 7, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
shapwill Posted May 25, 2020 Share Posted May 25, 2020 My site (running PS 1.7.6.5) uses a shipping module provided by our shipping provider, which adds the shipping price automatically based on the customer's address data. Thus, until the customer (or guest) has added their address at checkout, the cost of shipping is unknown. Instead of simply hiding this empty value (as one would expect), Prestashop shows the shipping as "Free", which is obviously misleading to the customer. The above solution did not solve my problem because it hides the shipping cost line forever. I want the shipping cost to show up when it is available (i.e. if the client has a registered address and the shipping module has added the price data). My solution is to hide the shipping cost (and not include it in the total) if it's 0. Here's how I solved the problem: (your files will vary, since I'm using a custom theme) Four files need to be modified: -themes/[theme name]/templates/checkout/_partials/cart-summary.tpl -themes/[theme name]/templates/checkout/_partials/cart-detailed-totals.tpl (for the cart and checkout pages) -themes/[theme name]/modules/ps_shoppingcart/ps_shoppingcart.tpl -themes/[theme name]/modules/ps_shoppingcart/modal.tpl (for the ajax cart preview) 1) cart-summary.tpl: replace everything inside {block name='cart_summary_subtotals'} with the following: {block name='cart_summary_subtotals'} <!--ADDED-->{if $cart.subtotals.shipping.value > 0} {foreach from=$cart.subtotals item="subtotal"} {if $subtotal && $subtotal.type !== 'tax'} <div class="cart-summary-line cart-summary-subtotals" id="cart-subtotal-{$subtotal.type}"> <span class="label">{$subtotal.label}</span> <span class="value">{$subtotal.value}</span> </div> {/if} {/foreach} {else} {foreach from=$cart.subtotals item="subtotal"} {if $subtotal.value && $subtotal.type !== 'tax' && $subtotal.type !== 'shipping'}<!--no shipping line if shipping cost is zero --> <div class="cart-summary-line cart-summary-subtotals" id="cart-subtotal-{$subtotal.type}"> <span class="label">{$subtotal.label}</span> <span class="value">{$subtotal.value}</span> </div> {/if} {/foreach} {/if}<!--END ADDED ---> {/block} 2) cart-detailed-totals.tpl: enclose the {foreach} statement with the following {if/else}, in which the {else} hides the shipping line if it's 0. <!--ADDED-->{if $cart.subtotals.shipping.value > 0} {foreach from=$cart.subtotals item="subtotal"} {if $subtotal.value && $subtotal.type !== 'tax'} <div class="cart-summary-line" id="cart-subtotal-{$subtotal.type}"> <span class="label{if 'products' === $subtotal.type} js-subtotal{/if}"> {if 'products' == $subtotal.type} {$cart.summary_string} {else} {$subtotal.label} {/if} </span> <h6 class="value">{$subtotal.value}</h6> {if $subtotal.type === 'shipping'} <div><small class="value">{hook h='displayCheckoutSubtotalDetails' subtotal=$subtotal}</small></div> {/if} </div> {/if} {/foreach} {else} {foreach from=$cart.subtotals item="subtotal"} {if $subtotal.value && $subtotal.type !== 'tax' && $subtotal.type !== 'shipping'}<!--no shipping line if shipping cost is zero --> <div class="cart-summary-line" id="cart-subtotal-{$subtotal.type}"> <span class="label{if 'products' === $subtotal.type} js-subtotal{/if}"> {if 'products' == $subtotal.type} {$cart.summary_string} {else} {$subtotal.label} {/if} </span> <h6 class="value">{$subtotal.value}</h6> </div> {/if} {/foreach} {/if} Then in the same file, add another {if/else} to change the total so that it won't include shipping if 0, but will account for any discounts/vouchers applied. (Since my site uses a comma as the decimal separator, I had to format the number accordingly here, followed by the current $currency.sign. <!-- ADDED-->{if $cart.subtotals.shipping.value > 0} <div class="cart-summary-line cart-total"> <span class="label">{$cart.totals.total.label} {$cart.labels.tax_short}</span> <h6 class="value">{$cart.totals.total.value}</h6> </div> {else} <div class="cart-summary-line cart-total"> <span class="label">{$cart.totals.total.label} {$cart.labels.tax_short}</span> <h6 class="value">{$cart.totals.total.amount - $cart.subtotals.shipping.amount|number_format:2:",":"."} {$currency.sign}</h6> </div> {/if}<!-- END ADDED--> 3) ps_shoppingcart.tpl: Modify div "cart-total" as follows: <div class="cart-total"> <!-- added-->{if $cart.subtotals.shipping.value > 0} <div>{l s='Shipping' d='Modules.Shoppingcart.Shop'}: <i>{$cart.subtotals.shipping.value}</i></div> {/if}<!-- end added--> {if $cart.subtotals.tax} <div>{$cart.subtotals.tax.label}: <i>{$cart.subtotals.tax.value}</i></div> {/if} {if Configuration::get('PS_TAX_DISPLAY')} <div>{$cart.totals.total_excluding_tax.label}: <i>{$cart.totals.total_excluding_tax.value}</i></div> <div>{$cart.totals.total_including_tax.label}: <i>{$cart.totals.total_including_tax.value}</i></div> {else} <!-- added-->{if $cart.subtotals.shipping.value > 0} <div>{$cart.totals.total.label}: <i>{$cart.totals.total.value}</i></div> {else} <div>{$cart.totals.total.label}: <i>{$cart.subtotals.products.value}</i></div> {/if}<!-- END added--> {/if} </div> 4) modal.tpl: Modify the "Total shipping" and "Total" code as follows: <!-- added-->{if $cart.subtotals.shipping.value > 0} <p><strong>{l s='Total shipping:' d='Shop.Theme.Checkout'}</strong> <i>{$cart.subtotals.shipping.value} {hook h='displayCheckoutSubtotalDetails' subtotal=$cart.subtotals.shipping}</i></p> {/if}<!-- END added--> {if $cart.subtotals.tax} <p><strong>{$cart.subtotals.tax.label}</strong> <i>{$cart.subtotals.tax.value}</i></p> {/if} <p><strong>{l s='Total' d='Shop.Theme.Checkout'}:</strong>  <!-- added-->{if $cart.subtotals.shipping.value > 0} <i>{$cart.totals.total.value}<span class="subtext">{$cart.labels.tax_short}</span></i> {else} <i>{$cart.subtotals.products.value}<span class="subtext">{$cart.labels.tax_short}</span></i> {/if}<!-- END added--> </p> This is working fine for me, but may need to be modified to suit your needs. I've attached the code here as well. ps_shoppingcart.tpl modal.tpl cart-detailed-totals.tpl cart-summary.tpl 6 3 Link to comment Share on other sites More sharing options...
Verlonimo Posted May 25, 2020 Share Posted May 25, 2020 Hi, @shapwill Thank your for taking your time and sharing your solution. Really appreciated. Regards Link to comment Share on other sites More sharing options...
BoshLog Posted June 10, 2020 Share Posted June 10, 2020 hi, can someone help me on how to change the "Shipping" statement to "Delivery" ? Link to comment Share on other sites More sharing options...
shapwill Posted June 10, 2020 Share Posted June 10, 2020 14 hours ago, BoshLog said: hi, can someone help me on how to change the "Shipping" statement to "Delivery" ? That's really a different issue than what we've been discussing here, but I think the easiest solution would be to find the relevant entry for "Shipping" in the translations editor and change it to "Delivery", but that could end up changing more instances of the word than you'd like. For a more targeted solution addressing only particular instances of the word, look in the aforementioned files for the following line: {l s='Shipping' d='Modules.Shoppingcart.Shop'} and change s='Shipping' to s='Delivery'. Link to comment Share on other sites More sharing options...
BoshLog Posted June 11, 2020 Share Posted June 11, 2020 8 hours ago, shapwill said: That's really a different issue than what we've been discussing here, but I think the easiest solution would be to find the relevant entry for "Shipping" in the translations editor and change it to "Delivery", but that could end up changing more instances of the word than you'd like. For a more targeted solution addressing only particular instances of the word, look in the aforementioned files for the following line: {l s='Shipping' d='Modules.Shoppingcart.Shop'} and change s='Shipping' to s='Delivery'. Thanks alot for the help! Link to comment Share on other sites More sharing options...
zod Posted June 24, 2020 Share Posted June 24, 2020 Thank you Shapwill, your post is very helpful, and I managed to fix two different themes, the logic is the same. Elaborating your code I found that there are some useless parts, to hide the shipping costs is enough, and the recalculation of the totals is pointless, so i did this: Point 1 I keep exactly as you have. Point 2 I keep only part one. The second part is useless because it doesn't make sense to subtract "zero" shipping costs from the total, and then apply discounts. So, the default code is good enough with or without shipping costs. Point 3 i skipped it totally. Your template is different from mines (and also from Classic theme), I think you have more strings (displaying taxes and shipping costs), but we don't have anything like that in the "normal" template, the Classic theme doesn't have the div "cart-total" even. Point 4 i kept only the first condition to hide the shipping cost row. The second part is pointless again, we don't need a distinction between a total with or without shipping cost since shipping costs is zero. Link to comment Share on other sites More sharing options...
shapwill Posted June 24, 2020 Share Posted June 24, 2020 Hi zod, I'm glad you found it helpful! Please not that Point 2 was necessary for me in order to have discount vouchers calculated. Without this code, the voucher was showing up as "-20%" (for example) but the total below was not affected. If you found a simpler solution to show the discounted total, please let me know! Point 3: good to know; I only tried it with my theme so I wasn't sure what would apply to the Classic theme. Point 4 was necessary for me because the plugin supplied by my shipping partner adds the shipping cost at checkout. Thus, shipping cost was showing up as "free" (0) until the customer went to the checkout page and selected the shipping method, then the shipping cost would be updated and was no longer free. I needed the code in Point 4 in order to show the shipping cost once it was made available by the shipping module. Without the code at Point 4, the shipping cost remained hidden even after the shipping method was chosen. Link to comment Share on other sites More sharing options...
zod Posted June 24, 2020 Share Posted June 24, 2020 Perhaps you have particular issues with your Prestashop or theme and/or you have a module interfering with vouchers/total. In my case the coupons are working fine, this is a screenshot: Also point 4 is weird, because your shipping module is processing the shipping cost like if it would be a product. Normally this should not happen. I made a test with the other shop I am developing, and after the shipping is configured, then the amount is correctly calculated in the cart... Link to comment Share on other sites More sharing options...
ttoine Posted August 10, 2020 Share Posted August 10, 2020 note that it will be a defaut feature in next version of PrestaShop: https://github.com/PrestaShop/PrestaShop/pull/13517 1 2 Link to comment Share on other sites More sharing options...
JWW Posted August 30, 2020 Share Posted August 30, 2020 I implemented the above solution into 1.7.6 and it did not fully solve the problem, particularly for visitors. I managed to find a decent and simple solution for this after a day of debugging. My solution for 1.7.6 for this problem was to first enable Geolocation, then add a check for the visitor's country in the Carrier class before the default Prestashop country is used. How it works: Geolocation stores the visitor's country iso code in the user's cookie and this is used to select the appropriate carriers and this is properly displayed in the shopping cart. If there are multiple carriers, then the options set in Shipping->preferences will determine what is shown. WARNING: This edit is done directly on a core Prestashop class. Do not do this on a production environment! classes/Carrier.php: line 1505 $id_address = (int) ((null !== $id_address_delivery && $id_address_delivery != 0) ? $id_address_delivery : $cart->id_address_delivery); if ($id_address) { $id_zone = Address::getZoneById($id_address); // Check the country of the address is activated if (!Address::isCountryActiveById($id_address)) { return array(); } // Start of edit // // Check for visitor's country } else if (isset(Context::getContext()->cookie->iso_code_country)){ $country_id = Country::getByIso(Context::getContext()->cookie->iso_code_country); $country = new Country($country_id); $id_zone = $country->id_zone; // End of edit // } else { $country = new Country($ps_country_default); $id_zone = $country->id_zone; } Hope this helps someone else. 1 Link to comment Share on other sites More sharing options...
Alexander Firsov Posted January 22, 2021 Share Posted January 22, 2021 (edited) Thank you very much for this solution. I am testing it now in Prestashop 1.7.7.1 It seems to be working as expected! Edited January 22, 2021 by Alexander Firsov (see edit history) Link to comment Share on other sites More sharing options...
Carlos Tecnomaia Posted January 19, 2022 Share Posted January 19, 2022 Hello, I can not find the files on my theme, I work with 1.6.1.24. Can anyone tell how to remove shipping from the cart? Regards, Carlos Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now