1

Currently my shipping methods configuration is like this:

  1. Free delivery (customer pays cash in the physical store and picks up his goods)
  2. Normal shipment (customers makes a bank transfer and gets his goods with regular shipping prices. I used default table rates "weight/destination").
  3. Cash on delivery (customers gets goods via shipping service and pays his goods to the delivery service. I used MatrixRate extension to get another "weight/destination" table rate

For payment methods i configured only "Bank transfer payment" named "Payment" with instructions. I didnt use multiple payment methods here, because everything is defined with shipping method selection.

My first question is .... is this a good practise? Or should I consider another option... Basicaly the customer only needs to know the shipping fee... and the store owner in Magento can see information from selected shipping method.

But there are some filters I need to implement. The store owner wants "Cash on delivery" to be disabled in case total order weight is below 100. Can someone help me implement this filter, because I am not comfortable to use an extension just for this one filter.

Thank you in advance.

1 Answer 1

2

You can observe the event payment_method_is_active. Something like this:

public function checkCashOnDelivery($observer){
   $method = $observer->getEvent()->getMethodInstance();
   if ($method->getCode() == 'CashOnDelivery Code here'){ //I don't know the code. Just check it in the payment method and add it here
        $quote = $observer->getEvent()->getQuote();
        if ($quote->getSubtotal() < 100){ //or $quote->getGrandTotal() to include shipping cost
             $result = $observer->getEvent()->getResult();
             $result->isAvailable = false;
        }
   }
}

read this to see how to use event observers.

1
  • thankx Marius. Your method is something I still need to look into, but I have no doubt that using the event observers this can be achieved. But I found another "easy" method. I found out that by editing the shipping method table and filtering the weight directly by making the first line start fromm 100 forward the method is automaticly not available if order weight is below 100.
    – no9
    Oct 30, 2013 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.