Jump to content

Minimal weight for carrier


cernicektomas

Recommended Posts

Hi please,


I am using PrestaShop 1.6.1.5 and I need little help with some changes in Carriers.


 


There is value MAXIMUM weight of delivery for each Carrier. I need to change this to MINIMUM weight of delivery. It means that this carrier would be available only for orders with weight higher than XY.


 


Could you please someone tell me if this change is possible and how difficult it would be? 


 


Thanks in advance,


Regards, Tomas


Link to comment
Share on other sites

It seems there's only one place that variable is used, so I should be easy to change. It's the following code on line 1413 of classes/Carrier.php:

                if ($carrier->max_weight > 0 && ($carrier->max_weight < $product->weight * $cart_quantity || $carrier->max_weight < $cart_weight)) {

You can try changing it to:

                if ($carrier->max_weight > 0 && ($carrier->max_weight > $product->weight * $cart_quantity || $carrier->max_weight > $cart_weight)) {

It's better to do this using an override so PrestaShop won't overwrite your code during an upgrade. Create override/classes/Carrier.php like this:

<?php

class Carrier extends CarrierCore
{
    // Paste your getAvailableCarrierList function here with the changed line
}

Remember to go to the Advanced Parameters > Performance tab and click the "Clear cache" button (or manually delete cache/class_index.php) so PrestaShop can find the override.

Link to comment
Share on other sites

  • 1 month later...

This is awesome!!! I have been looking for this for quite a while. I have a question. In my scenario, I need to set a Minimal order amount for a carrier. For instance, I have one specific carrier acts as a dedicated carrier with subsidized charge. I would like to activate this carrier when and only when an order amount is above a certain value. The idea is that I want to subsidize a shipping charge of faster carrier for a customer who buy more.

 

Thank you very much,

Boon

Link to comment
Share on other sites

  • 8 months later...

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
×
×
  • Create New...