Shopify custom bundle: Products listed as line item properties and inventory update on order
I'm making a custom bundle "builder" with Shopify Theme Sections for my client and I managed to add products from the bundle as Line item properties (it's easier to remove it as only one item, then as 5+ items). Now I'm not sure how to finish the order process and update the inventory of the products listed as line item properties.
How to "connect" the Cart and Checkout pages and transfer the info about the products, so it can affect the inventory after the order is finished? Should I add a hidden fields on the Cart page (for those products listed as the properties), or should I do something else (e.g. add a Private app with some hook that'll update the inventory in the background or maybe add all products to the cart page and hide them with JS and add some logic for their removal)?
Here is the checkout screenshoot as an example - https://www.dropbox.com/s/j6cu985wcpfp4t9/shopify-cart-products-as-line-item-properties.png?dl=0 (https://www.dropbox.com/s/j6cu985wcpfp4t9/shopify-cart-products-as-line-item-properties.png?dl=0)
Thanks in advance!
You are on the right track. You cannot do hidden products or line item properties though. Instead, when you add a bundle to the cart, add all the products in the bundle. That is how you accomplish a checkout. Tie the items together using Line Item Properties, and you can handle delete/remove/update code in the cart with JS. Since the customer would be buying products, inventory is then automatic.
You cannot escape having the customer seeing an paying for a variant ID, with a quantity and a price. Trying to hide that in a bundle will never work, although you can be creative and disguise line items as being together with good code.
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.