11

I have the following situation:

I am on the checkout page, and i have 3 Shipping methods. If i select a specific method form all 3 and i finish the order, i want a comment to be added automatically on the orders view from backend in this area:

enter image description here

Does anyone have any idea how can i do this?

9

You'll want to create an event-observer module & observe sales_order_place_after.

Your observer method would look like this:

public function logShipping($observer){
    $order = $observer->getEvent()->getOrder();
    $history = $order->addStatusHistoryComment($order->getShippingMethod(), false);
    $history->setIsCustomerNotified(false);
    $order->save();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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