Jump to content

Disable carrier when order value bigger then 100$


Recommended Posts

Thank You for respond.

If I undestand Your suggestion You're talking about setting carrier based on order price. But the shipping price depends on weight of order, so the price ranges has to be set on weight. What I need is disable one carrier (cash on delivery) if the order is to expensive.

Link to comment
Share on other sites

Cash on Delivery is a payment method, not a carrier. That changes things. In that case, you can change line 83 of modules/cashondelivery/cashondelivery.php from:

        if ($this->hasProductDownload($params['cart']))

to:

        if ($this->hasProductDownload($params['cart']) || $params['cart']->getOrderTotal() > Tools::convertPrice(100, $params['cart']->id_currency))

This should hide the Cash on Delivery payment option when the order total is greater than 100.

  • Like 1
Link to comment
Share on other sites

Hello. I'm using DPD carrier module (dpdpoland module) that has 2 different shipping options. One is regular shipping and other is COD shipping. I need to disable COD carrier for big orders. I looked into modules/dpdpoland/dpdpoland.php to find point where there is made decision if option is available but so far no luck.

 

I think I'm looking for some global function, some point in prestashop code that is choosing available carriers for current order to add an additional restriction.

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 year later...

Does anyone can help about this?

i want to disable a carrier for order amount bigger than 35 euro

i have two carriers i want to display the first fot total order amount below 35 euro and second

bigger than 35 euro. i use weight ranges at both.

Link to comment
Share on other sites

  • 5 years later...

Hello,

one option for PS 1.6.1.xx is to make override of the class - Carrier.php. Put in in folder override/classes and leave only the function getCarriersForOrder().

In this function after line 70 put the following:

$configuration = Configuration::getMultiple(array(
                        'PS_SHIPPING_FREE_PRICE',
            'PS_SHIPPING_FREE_PRICE2'            
                    ));
                    
                    $NonFreeCarriers = [
                                'XXXX carrier',                
                    ];
                    
                    $free_condition_price = Tools::convertPrice((float)$configuration['PS_SHIPPING_FREE_PRICE2'], Currency::getCurrencyInstance((int)$cart->id_currency));
                    $orderTotalwithDiscounts = $cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, null, null, false);
                    if (in_array($row['name'], $NonFreeCarriers) && $orderTotalwithDiscounts >= (float)($free_condition_price) && (float)$free_condition_price > 0) {
                        
                            unset($result[$k]);
                            continue;
                        
                    } 

 

Of course you should have set before that the price for free delivery (in my case are two: PS_SHIPPING_FREE_PRICE2). That is all.

Your XXXX carrier (name of carrier) will be disabled for orders over PS_SHIPPING_FREE_PRICE2.

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