I’m trying the cart transformation API and it works quite well. My bundle product can be expanded with the products components. My app uses the order/create webhooks to track new orders. It will be stored in the database if any line item is a bundle product.
When the order is checked out, I can’t track it because the bundle product is replaced by individual products. How can I track the bundle orders? Also, how is a transformed order different from an ordinary order, let’s say the customer purchases the same products one by one?
It seems like you’re trying to track bundle orders created through the Cart Transform API in your database. Here’s how you can approach this:
Using Metadata or Properties: When you create a bundle product using the Cart Transform API, you can include metadata or properties to mark the product as a bundle. This way, even when the bundle is broken down into individual products, the metadata or properties will remain associated with each product, and you can use this to track bundled products in your orders.
2. Comparing with Original Cart: Before applying the Cart Transform API, you can save the original state of the cart (i.e., the bundle product) in your database. Then, after the transformation, you can compare the order items with the original cart to determine which items were part of a bundle.
3. Comparing with Product Database: If you have a record of all your bundle products and their components in your database, you can cross-reference this with the incoming order to identify if the order contains items that are part of a bundle.
4. Identifying Transformed Orders: In terms of differentiating a transformed order from an ordinary order, there isn’t a direct way to do this currently with the Shopify API. As mentioned, you could use metadata or properties to identify transformed orders or compare the order with your records of bundle products.
As for the “Data” part of your request, it would depend on your specific implementation, but generally, it would include the id of the cart and the transformation details (the products to be added or removed).
Thanks for your prompt reply, Liam. Forget to tell you my app works on customized bundles:
Yes, metafields remain with the product after checkout. But this is no difference from buying the product one by one. I can’t tell whether they buy my bundles or not. Line item properties are attached to the parent variant. The variant is removed during cart transformation
Checkout create/update webhooks may be used to check the line items. I can store the cart token and checkout id/token to my db. This approach may work but the traffic or loading is huge (e.g. stores x checkouts x recent 30 days). I am not sure if it’s feasible for bfcm.
No, I don’t have all my users stores’ products in db. Just too many of them
It’s quite common for stores to track the bundle orders. Some users even ask me to report all bundle orders for them. Otherwise, they can’t tell whether the app is useful or not