Is there a way to detect orders that are placed via API? I want to add to those orders a different order number prefix.
I have already created an observer that is changing the prefix based on payment method of the order and I want to extend it to change the prefix based on order placed on web or API.
Event for observer now is sales_order_place_after
Can someone please help me?
You can manage it like below:
Magento 2 database contains a table name 'sales_sequence_profile' which has prefix column and every row contains a meta_id which relates with table 'sales_sequence_meta'.
Table 'sales_sequence_meta' sequence table names according to stores and type(order, invoice, shipment, creditmemo, rma).
Basically this is just for understanding. You need to update the table 'sales_sequence_profile' and related sequence tables.
Hello @Bhanu Periwal,
I have an observer that is doing that and I want to fix it in observer but what I need to take into consideration are the prefix for:
Basically I need 4 types of prefix.
Because of this, the functionality that I need now is a way to detect when an order comes from API vs orders that comes from web
Can someone help me with this?