0

I create a new Order Status: Synced To B1 in Sales > Orders Status is empty for orders having this new status, but when I open order the status is here Do you have any Idea How to show custom status in orders list grid?

Note That I Updated the Status using REST API by POST to: /rest/all/V1/orders/64/comments

{
  "statusHistory": {
    "comment": "Success Imported to SAP DocNum:89441",
    "created_at": "2019-06-03 08:20:27",
    "parent_id": 64,
    "is_customer_notified": 0,
    "is_visible_on_front": 1,
    "status": "SyncedtoB1"
  }
}

enter image description here

enter image description here

0

That should come through

Clear cache

php bin/magento cache:clean

Run indexer

php bin/magento index:reindex

I'm wondering whether your order grid table is a bit behind

Update based on comment

First try this SQL query to sync status between order table and order grid table

update sales_order_grid sog, sales_order so set sog.status = so.status where sog.increment_id = so.increment_id 

Next. Are you setting custom status programatically?

If so code should look like this

use Magento\Sales\Api\OrderRepositoryInterface;

public function __construct(
    OrderRepositoryInterface $orderRepository,
    ...
) {
    $this->orderRepository = $orderRepository;
}

public function method($orderId) {
    $order = $this->orderRepository->get($orderId);
    $order->setStatus('whatever');

    try {
        $this->orderRepository->save($order);
    } catch (\Exception $e) {
        // handle exception
    }
}
  • No, It's not fixed – Yezzy Sarl Jun 2 at 21:06
  • I haven't access to mysql database, I Updated the Status using REST API by POST to /rest/all/V1/orders/64/comments => {"statusHistory": {"comment": "Success Imported to SAP DocNum:89441","created_at": "2019-06-03 08:20:27","parent_id": 64,"is_customer_notified": 0,"is_visible_on_front": 1,"status": "SyncedtoB1"}} – Yezzy Sarl Jun 2 at 22:21
  • If you've got code access you've got sql access webkul.com/blog/magento2-write-custom-mysql-query – Dominic Xigen Jun 2 at 22:40
  • No, I'm using C# to consume REST API, I haven't access to php code also – Yezzy Sarl Jun 2 at 22:47
  • If you haven't got code or db access there is nothing I can suggest to fix – Dominic Xigen Jun 2 at 22:56

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.