Shopify Cart Validation Function not appearing in Shopify Admin Checkout Rules

Hi there! this is my first post in Discord - and i should probably highlight that im a complete newbie to Gadget. Im a frontend Shopify Developer way out of his comfort zone having a go building an app for the first time. im basically trying to create an app for a client (on Plus) that sells a health drink on subscriptions. on first time purchase the customer gets a couple of free gifts added to the line items in checkout. however, some are bypassing the rule that it should be only a first time purchase by cancelling subscriptions, then re-purchasing. So with Gadget, im trying to build an app that can check the email address inputted, if its been used for an order in the past then remove the free gifts automatically. App: reformed-no-free-gifts App URL: https://reformed-no-free-gifts--development.gadget.app I've deployed a Shopify Function (free-product-validator) for cart/checkout validation. The function: ✅ Builds successfully (WASM file generated) ✅ Deploys without errors via yarn shopify:deploy:development ✅ Shows as "Released" in Shopify Partner Dashboard (version reformed-no-free-gifts-develop-9) ✅ Listed in Partner Dashboard under "Functions" with handle free-product-validator ❌ Doesnt appear in Shopify Admin → Settings → Checkout → Checkout rules Expected outcome: The function should appear under "Checkout rules" in Shopify Admin so I can enable it to validate carts and block checkout for customers with free products who have previous orders. What I've tried: Waited 10+ minutes for propagation Refreshed Shopify Admin multiple times Updated API version from 2025-07 to 2025-10 to match app Verified function.wasm exists in dist/ folder Function details: Target: cart.validations.generate.run API version: 2025-10 Uses customer metafield: customer_attributes.hasReceivedFreeProducts Is there a configuration step I'm missing to make Shopify recognize the function in the Admin UI? https://share.cleanshot.com/1Z5xdnfL
8 Replies
Chocci_Milk
Chocci_Milk2w ago
Hello, I think that the part you're missing is making sure that the store has the cart function pushed to it on app installation. Here's a template of ours that might point you in the right direction: https://github.com/gadget-inc/templates/tree/main/shopify/product-bundler-public-remix-ssr Specifically this part (line 181): https://github.com/gadget-inc/templates/blob/main/shopify/product-bundler-public-remix-ssr/api/models/shopifyShop/actions/install.ts Also make sure that you have a dev store that has customer and checkout extensibility enabled. You need to test on that Have you been running the dev command in your gadget/local terminal in order to get a preview link? I might be mistaken about this but its a good thing to look into If none of this fixes your issue, you might be better off asking Shopify support for some help
graftstudio
graftstudioOP2w ago
hi @Chocci_Milk thanks so much for the info - i took your github link and using the AI tool it was able to resolve that particular issue of not seeing the app under checkout rules - thanks for that! it has meant however i got pulled into a rabbit hole of AI hallucinations hitting dead ends everywhere. The tool was dead certain at the beginning that this was possible: 1. if a customer has purchased a product that came with free gifts auto-added to checkout, we would be able to block that person from making the same purchase. if they were to try again, it would look up the email address and if found in previous orders - it would remove the free gifts from the checkout line items 2. it was also certain that by using functions we would be able to apply this to guest checkouts, not only when customers are logged in. However, it is now saying as a limitation of functions we cannot do this unless customer is logged in. and is now suggesting discount codes which wont work for us unfortunately. Any advice here? AG1 https://drinkag1.com/ does this really well. Thanks in advance.
Chocci_Milk
Chocci_Milk2w ago
Mind explaining the use case a little more? I'm not fully understanding what criteria allows a user to add an item to a cart or not. Have you also looked at checkout UI extensions? You might still have the logged in customer restriction but you would be able to make calls to your backend to see if a code has been used or not (not great but better than nothing). The assistant is still AI and doesn't know everything so I would take what it says with a grain of salt. Even Shopify's assistant hallucinates on their own docs and implementation
graftstudio
graftstudioOP2w ago
sure, so the client is a 'collagen coffee' brand and its a subscription only product. currently when a customer purchases a new subscription to a drink, along with setting up their subscription payment they are also receiving like 2 or 3 accessory products for free. its done using javascript in the theme itself by adding variant IDs. pretty straightforward. once a customer is a subscriber, they'll likely be making monthly payments to receive their drinks each month but if they cancel that subscription, and at a later date decide they want to renew this, they are able to purchase from the website a new subscription etc - but the free products get added to checkout again, meaning they will have received them twice, for free. so the purpose is to read the email address inserted at the checkout, check it against the order database and if that email address is not found, keep free products in there, but if it has been found, then automatically remove the free products so they are only getting the drinks they have subscribed for.
Chocci_Milk
Chocci_Milk2w ago
Hmmm, might it be a good idea to instead make this UI only available from a customer account page? Or to make a checkout ui extension that removes the item form the cart if they aren't logged in (or blocks checkout) Would a cart validation function make sense for that too?
graftstudio
graftstudioOP2w ago
i may have found a way to do this by creating a discount code and a url that auto adds it to checkout - that also solves the one time use issue. thanks for you help!
Chocci_Milk
Chocci_Milk2w ago
No problem! Let us know if you need more help. For the time being, I'm going to close this ticket!
Gizmo
Gizmo2w ago
Do you like this answer? ​

Did you find this page helpful?