We have a scenario in which we want to add/remove items to a person’s cart based on other items they’ve selected. Can this be one using shopify functions/cart extensions?
Topic summary
A developer wants to dynamically add or remove items from a customer’s cart based on their current selections using Shopify cart/checkout functions.
Proposed Solution:
- Checkout UI Extensions can handle this requirement
useCartLinesAPI allows monitoring cart state, including line item quantities and attributesuseApplyCartLinesChangeAPI enables creating, updating, or deleting items based on specific conditions
Technical Requirements:
- Knowledge of Remix, React, and Node.js is necessary
- Provides flexible customization capabilities
Alternative Approach:
- If building a custom extension seems challenging, using a compatible Shopify app is recommended instead
- The responder requests app suggestions if anyone knows of suitable options
@emiller It seems achievable using Checkout UI extensions. What do you think? ![]()
Checkout UI Extensions Documentation
You can use useCartLines to check the state of the cart, including retrieving line item quantities and attributes.
Additionally, by using useApplyCartLinesChange, you can create, update, or delete items based on certain conditions.
Knowledge of Remix, React, and Node.js will be required, but it allows for flexible customization.
If this seems challenging, I recommend using a compatible Shopify app instead.
If anyone knows of a good app, please share! ![]()