Hi ,
I would like to create custom state as Dispatch and status as Dispatched. Please anyone can help ASAP.
Solved! Go to Solution.
Try it with directly adding from Database:
Modify below 2 tables:
sales_order_status
sales_order_status_state
First add in this table "sales_order_status" > Status = dispatched and label = Dispatch
Now add in this table "sales_order_status_state" > status = dispatched, state = dispatched
It will work for you.
Sharing here few articles to follow:
https://www.mageplaza.com/kb/how-to-create-custom-order-status-magento-2.html
https://magecomp.com/blog/create-custom-order-status-state-programmatically-magento-2/
Hope this will help you.
Hi @tippanna_pawar
You can follow the magneto documentation to create new order status and assign the order state to it.
https://docs.magento.com/user-guide/sales/order-status-custom.html
I hope it will help you!
Thank for Suggetion. But still my issue not resolved. I have created Status as Dispatch but i want to create new state for that. I am unable to create new state
Thank you for suggestion. I have created module as per the post but throwing database error on magento module Upgrade.
This is the below error
Installing data... SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`dnour`.`sales_order_status_state`, CONSTRAINT `SALES_ORDER_STATUS_STATE_STATUS_SALES_ORDER_STATUS_STATUS` FOREIGN KEY (`status`) REFERENCES `sales_order_status` (`status`) ON DELETE CASCADE), query was: INSERT INTO `sales_order_status_state` (`status`,`state`,`is_default`,`visible_on_front`) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE `status` = VALUES(`status`), `state` = VALUES(`state`), `is_default` = VALUES(`is_default`), `visible_on_front` = VALUES(`visible_on_front`)
Hi @tippanna_pawar
Try the below stack solution,
https://magento.stackexchange.com/a/229948
Might be it will help you for order state.
are you still recommending to use installData? as this is deprecated in my knowledge.
Try it with directly adding from Database:
Modify below 2 tables:
sales_order_status
sales_order_status_state
First add in this table "sales_order_status" > Status = dispatched and label = Dispatch
Now add in this table "sales_order_status_state" > status = dispatched, state = dispatched
It will work for you.
Thank you brother. Your suggetion worked for me. Thanks a lot.
Definitely allow me sometime, I will provide you that too.