We have developed one custom app for a restaurant client. Its about adding pizza toppings.
Due to the 100 variant limit of Shopify, we have created the variants as extra options and shows them under each pizza. Customer can select pizza type and the toppings and add to cart.
We will add the selected toppings price to ajax cart and override the with product price and show them in cart page.
When the checkout button is pressed, we just create the toppings as additional product and after the order is done, we will call webhook to delete the temporary created product.
1. My question is whether there is any other logic for adding extra or addon pricing ?
2. We are creating temporary product at checkout button click and delete the product after order confirmation using webhook call. So if the user didnt complete the order, that product will be listed in the site when someone search. How can we remove it?
All the suggestions and helps are welcomed.
Shopify Store Setup
Customize Shopify Theme
Develop Custom Shopify App
For any Shopify Developments : http://expertsinshopify.com
Solved! Go to the solution
This is a very interesting scenario. Assuming you are using the REST API, you can create a product and choose to not publish it. Check here --> https://shopify.dev/docs/admin-api/rest/reference/products/product#create-2020-10. Under "Create a new unpublished product." This means that the temporary product won't be visible online for shoppers.
Hope this helps!
Are you talking about using Shopify POS or e-com? For POS, I created POS add-ins that create a custom product on the fly (non-published), add that custom product to the cart, and allow checkout just fine. Thinking about it, our e-com website allows the users to create a custom jewelry piece via a third-party IFrame. Then that is pushed into Shopify as a new non-published product, and that is added to their Shopify cart just fine as well. I'll try to pull up the code as to how we did that shortly!
This is an accepted solution.
I see now. Hadn't looked at the underlying source code in awhile. I utilized the GraphQL API for creating a new product. And setting published: false will create the new product that's hidden from web consumers. And it definitely allows the web consumer to add that new product to cart, although it's an automated step via the API requests/responses. The third-party IFrame fires a completed event to the parent page. This event's data contains all of the attributes for the new custom product. I listen for that event, handle it by creating the new Shopify product on the fly, and listen back for its ID after it's created. That ID I then automatically push into the cart. Works fine.
oh great. So need to try with graphql and see. Maybe that will work.
Also thanks for your solution.