Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
Hi there!
We have products that have specific metadata like: "custom.isPreorder" : "true". We're looking to write that data to the order line item at some point before the transaction is submitted, so that it can be included in the Webhook to our ERP. Is there a way to do this via a Flow? We attempted to set an order tag with the the Order Transaction, but the webhook fires before the tag is set. Any ideas would be welcome!
Hi!
To write the specific metadata "custom.isPreorder" to the order line item before the transaction is submitted, you can utilize Shopify's Script Editor. This allows you to customize the checkout process and modify the order data.
Here's an approach you can consider:
1. Access the Script Editor in your Shopify admin.
2. Create a new script or edit an existing one.
3. In the script, use the `input.order.line_items` variable to access the line items in the order.
4. Iterate through the line items and check for the "custom.isPreorder" metadata.
5. If the metadata is present and matches your criteria, you can update the line item or add a new property to store the preorder information.
6. Once you've made the necessary modifications, the updated line item data will be included in the webhook payload sent to your ERP.
By using the Script Editor, you have more control over the order processing flow and can manipulate the order data before it's submitted.
Remember to test your script thoroughly to ensure it functions as expected and doesn't interfere with other aspects of your checkout process.
Hi @PMike ! Thank you so much for your reply. I was hesitant to use the Script Editor approach since Shopify declared they were going to deprecate it (https://changelog.shopify.com/posts/shopify-scripts-deprecation); hence why I was trying to maximize Flow.
For the time being I was able to put into place a workaround. We're reading the product metadata when we Add To Cart, and will set a line item property that way. It's not perfect (because the SOT can change between add to cart and order submission) but it works for most instances.
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024