I want to check whether an order is created by an Admin or by the customer.

  • specify your requirement into detail, what you are looking? Commented Mar 1, 2019 at 10:59

3 Answers 3


By default, Magento2 only stores the remote_ip in table sales_order for an order that is place by customer (while admin order is set to null).

  //place customer
  // place by admin
  • I will try this and let you know if it works.
    – Avesh Naik
    Commented Mar 1, 2019 at 11:08
  • This not work at all. Follow this example: I am the admin with ip, and I create an order on the backend side. The remote_ip field is empty. I also have a customer account, but my ip is always, I create an order on the frontend side. The remote_ip field is empty. So this is not a reliable way to determine if the order was created by admin or customer.
    – fmineo
    Commented Apr 8, 2020 at 9:00
  • I think, now for all orders remote ip is added if placed from admin also. Commented May 4, 2020 at 6:58

Try this,

namespace Vendor\Module\Controller\Orders;                                
class ReadOrders extends \Magento\Framework\App\Action\Action                 
 public function __construct(
    \Magento\Framework\App\Action\Context $context,
    \Magento\Sales\Api\OrderRepositoryInterface $orderRepo
    ) {
    $this->orderRepo = $orderRepo;

public function execute()
    $orderPlaced = '';
    $entity_id = '12';
    $order = $this->orderRepo->get($entity_id);
    $orderPlaced = $order->getRemoteIp();
    if ($orderPlaced) {
        echo "Placed by Customer";
    } else {
        echo "Placed by Admin";

Hope this helps :)

  • 1
    Where is this placed?
    – Nick Piro
    Commented Sep 22, 2020 at 18:02

You can log this with observers. Just use the sales_order_place_after event within the etc/adminhtml directory inside the events.xml to log that an order has been created by an admin. You can do this for every area. More about areas Here.

Example of the events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_order_place_after">
        <observer name="My_observer_name" instance="Vendor\NameSpace\Observer\LogOrderAdmin"/>

I suggest you create an extra order field via a InstallSchema where you can log this to.

  • I will try both ans.
    – Avesh Naik
    Commented Mar 1, 2019 at 11:15

Your Answer

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

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