For my condition how to get the shipping methods before order placed

My Observer : https://gist.github.com/ZusZus/66da0a7aaeb0db53eff38d8bb89ae941


The event before placing order is “sales_order_place_before“


How to do an action if an order is placed by a customer

You have 2 events you might use (there might be others).
sales_order_place_before is dispatched before the order is placed. sales_order_place_after is dispatched after the order is placed.
You can create an observer for one of those events. You will find here a tutorial on how to create observers.
You can access the order in your observer method like this:

public function doSomethingHere($observer) {
    $order = $observer->getEvent()->getOrder();

You can use sales_order_place_before event before placing the order.

Also, for getting shipping description for the order, you can use below code in your observer.

$order = $observer->getEvent()->getOrder();
echo $order->getShippingDescription();

If you want shipping method data, then you can use below code

$shipping = $order->getShippingAddress()->getShippingMethod();


I've changed $Observer to $observer in your Observer.php file. I think the issue is with the naming of the observer variable.

class Gta_KolupadiRestrict_Model_Observer {
    public function cartevent($observer) {
            $order = $observer->getEvent()->getOrder();
            $shipping = $order->getShippingAddress()->getShippingMethod();

Hope it helps!!!


In magento1 try to do with this event sales_order_place_before which is work with before place order. and put in config.xml


hope its work for you

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