Shopify - Validate cart items at checkout?
Solution:
If you are on the Shopify Plus plan there are two things you can do:
- During checkout validation - use Script Editor (https://help.shopify.com/en/manual/checkout-settings/script-editor) to check the cart contents and if it's invalid, set the base product quantity and additional products to 0. This will prevent customers from checking out.
- Post checkout validation - use Shopify Flow (https://help.shopify.com/en/manual/shopify-flow) to cancel the order after it's placed and if it's invalid
But that's a lot of development, especially when you are not familiar with it, it will be hard to go through and make it work as expected (covering all edge cases). It's possible to create a such script but analysis of all possible scenarios and writing a code for it will take some time. If I were you I would consider an app that creates bundles as a single item. Adding such a bundle to the cart takes a few seconds to process as the app is making some admin API calls in the background but it solves your problem. I cannot promote any paid solution on StackOverflow but you will easily find something - there are plenty of solutions in the app store.
The decision comes down to your estimation + possible change requests and fixes vs. the cost of the app on a yearly basis
Source
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.
Similar questions
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.