Differentiating Backend vs. Frontend Purchases in Magento

前端 未结 3 2050
清酒与你
清酒与你 2021-01-05 06:43

Is there a way to tell if an order was placed through the frontend of the web site or entered through the administrative panel?

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-05 07:09

    Every order has a store_id, when entered through administraction it will either be 0 (for 'admin' store) or null.

    if ($order->getStoreId()) {
        // was placed via frontend
    }
    

    Don't use getStore() as that won't always return the admin store object reliably.

    Does not work with latest versions of Magento. (see comment)

提交回复
热议问题