Scripts + Launchpad setup to Functions

Hi, I currently use Shopify Scripts together with Launchpad to schedule and manage sales events. When a sale starts (via Launchpad), two scripts are activated:

  • A line item script that blocks discount codes during the sale and displays a checkout message to customers explaining that discount codes aren’t available.

  • A shipping script that hides certain shipping methods (e.g. “express”).

I’ve started experimenting with Functions:

  • For line items, I successfully limited quantities (max 10 per product), but I couldn’t find a way to show a message or explanation to the customer. The Function silently enforces the limit without feedback in the side cart or checkout.

  • For shipping, I can hide methods, but I can’t schedule or automate this with Launchpad—I need to toggle it manually.

My concerns are:

  1. With Functions, how can we provide clear feedback to customers when rules are applied (e.g. quantity limit, discount codes blocked)?

  2. Is there any way to schedule or automate Functions so they activate/deactivate with events (like Launchpad does with Scripts)?

Any guidance or best practices for these use cases would be greatly appreciated!

Thank you,
Cecilia

For the quantity limit messages showing, I believe it depends on the theme you’re using on how it handles the response to adding items to the cart, the message should appear in the response in the browser to hitting that limit when you try adding an item beyond your limit.

For scheduling or automating the application of Functions, you can make use of cart.shop.localTime.dateTimeBetween to check and apply validations, delivery customizations, or other between two given datetimes.

You can also use input query variables to dynamically set these as input to your function so you can update these values in a configuration UI style experience.