How to split an order using Shopify functions? Do I need to split the order using some product attribute using Shopify functions or is there any other alternative? I need it to be like the image
Hey Regis,
the use case your are hinting at isn’t something possible with Shopify Functions at the moment.
Most implementations that are splitting orders do so via the Admin GraphQL API, after the initial order has been created.
Can you give a little bit more context on what you are trying accomplish? Maybe using multiple FulfillmentOrders within one order could be an option worth exploring?
Hope this helps,
Kevin
@Kevin_Sieger The products are sold by different suppliers, so they want each supplier to have their own separate order. Another question is: is it possible to create multiple carts for each vendor?
Normally, this is THE use case for FulfillmentOrders. Each supplier gets a Location with its specific product variants (= inventory items) assigned to it. That way, one order is automically divided into multiple fulfillment orders. Each fulfillment order can have it’s own fulfillments with individual shipping infos.
What really helped me to get a deeper understanding of the order and fulfillment order data model was the “Apps in orders and fulfillment” pages in the docs.
If you or the merchant still would prefer completely seperate orders, you can take a look at the orderCreate mutation. You could use that mutation after the initial order is created to create multiple “sub-orders”, each containing its designated line items.
Can you elaborate a little on that? Generally, you could modify your theme (and/or create a Shopify Function) in a way as to only allow carts containing products from one vendor. Is that the goal?
Hope I could give you a little context,
Kevin