We have setup webhooks on our Shopify store. The process we have automated is as follows:
1. We have a store where end-customer can select product and add to cart
2. End-customer selects a product and adds to the cart
3. A webhook event with cart-creation is triggered to our external URL
3. In the external URL, we have a Python based flask engine running. This engine receives the webhook with the product data
4. Based on the product selected, we process and create a list of recommendation products. Example, if end customer selects shoe and adds to the cart, the Python based engine recommends socks.
• How can we send the list of recommended products back to the shopify shop?
• How can this list of recommended products be displayed to the end-customer?
Have a look at the App Proxy for displaying data on the site. https://shopify.dev/tutorials/display-data-on-an-online-store-with-an-application-proxy-app-extensio...
I'm not sure how you would go about identifying the session that needs the recommended products. If you have a very small number of products and no dynamic mapping then the json idea might work.
Consider this: If you have two customers viewing the shop at one time, and one of them puts a pair of shoes in the cart, they should be shown a recommended product of socks. But if customer number 2 is viewing the shop and puts a shovel in their cart, they will need to be shown a different recommended product, like a bucket. If you want to load all of these items into your json file, that might work, but its going to be a very large file eventually, which will ultimately slow down the shop <- not good!