We're working on an interesting project that I could do with some community assist in the initial direction.
We would like to build a custom drag and drop solution, where a customer drags items available in store to create a new item (made from those items). The best metaphor is - 'dragging individual Lego pieces with a cost of $1 each, to form a new item - a Lego car - with a cost based on the cumulative items selected'.
This new product (the Lego car) is sent to checkout for the customer, the cost based on the individual items selected.
What would the best approach be here?
We've got a few ideas, but I'm unsure any are quite right. So any help here would be of great assitance,
Welcome to the Shopify Community!
I like your app idea. It sounds like something merchants will find useful.
I am assuming you want to create products on-the-fly and add them to the user's cart. You want the products to be created based on the user's input using the drag-n-drop builder.
I've solved a similar problem before using two parts.
(1) A server-side app that, in response to a request from a client-side script, creates a new product using the Shopify REST/GraphQL API. The server app returns the product object of the newly created product (or an existing product if created already) to the client script.
(2) The client-side script (which is part of your app that the merchant installs from the app store) is triggered in response to an "Add to Cart" click. The client script builds and sends a JSON request with the details of the product to be created. The product details were provided from the drag-n-drop builder part of your script. When the server returns the product object of the newly created (or existing) product, the client script adds the product to the cart.
It's a simple solution that has been working for me over 5 years without a single hiccup.
Shoot me an email if you ever want to chat about the problem you're solving with this app.
Brian | Shopify Partner | Ecommerce Consultant
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
- Need further assistance? Visit www.BrianAtWork.com
|an hour ago|