No More Refunds: How to Set Time-Specific Product Availability on Shopify
Ever found yourself in a tricky spot where your store has different operating hours for different product lines? It's a surprisingly common scenario, especially for businesses like cafes or restaurants operating within a larger retail space. A recent discussion in the Shopify community perfectly highlighted this, and it's a goldmine of insights for store owners facing similar challenges.
Our fellow merchant, carriec228, kicked off the thread with a classic dilemma: their store is open 10 AM-5 PM, but their in-store cafe items are only available for pickup online between 10 AM-3 PM. The problem? Customers were still placing cafe orders after 3 PM, leading to the tiresome task of issuing refunds. Sound familiar? Let's dive into how the community tackled this, and the robust solutions that emerged.
The Core Challenge: Beyond Just Hiding Products
One of the first and most crucial points that multiple experts in the thread emphasized is that simply "hiding" products or collections in your theme isn't enough. While it might deter casual browsers, as folks like Ploqo and HBNStudio pointed out, someone with a direct product link, a saved cart, or using an accelerated payment method like Shop Pay could still bypass the visual restriction and place an order. That's why the consensus was clear: you need a solution that blocks the purchase at the cart and checkout level.
Ramadan_Alex, Amisha_BC, and websensepro all echoed this, suggesting the focus should be on controlling when cafe items can actually be purchased, not just when they're visible. This product-level availability is key.
Solution 1: Harnessing Shopify Flow for Automation (No-Code)
For those on a Shopify plan that includes Shopify Flow, Mustafa_Ali offered a neat no-code approach. Flow is a powerful automation tool that can react to events in your store. The idea here is to:
- Set up a scheduled Flow workflow to run daily at 3:00 PM. This workflow would set your cafe products or collection to "out of stock" or unpublish them from your Online Store sales channel.
- Create a second scheduled Flow workflow to run at 10:00 AM the next day, making those products available again.
This is a solid option for automating the process without diving into code, assuming your plan supports Flow.
Solution 2: Specialized Pickup & Order Scheduling Apps
Another popular no-code or low-code solution revolves around using dedicated apps from the Shopify App Store. Ellie-BOGOS, Amisha_BC, and Ploqo all highlighted this as a practical route. These apps are specifically designed for pickup scheduling, cutoff times, and product-specific availability.
When looking for an app, the community advised checking that it:
- Supports product-level availability (so you only affect cafe items).
- Allows you to set specific cutoff times.
- Crucially, blocks checkout, not just the "Add to Cart" button.
Ellie-BOGOS even recommended a couple of free plans to start with:
- Pickup Delivery Date Pickeasy
- Genie Store Pickup
Here's an example of how such an app might look when configuring settings:
Solution 3: The Robust Approach - Cart & Checkout Validation Functions (Custom Code)
This is where the community really shined, with Ploqo and forgecro detailing what many consider the "right way" to solve this for ultimate reliability. Shopify's Cart and Checkout Validation functions are powerful tools that run directly at the checkout level, ensuring that orders are blocked if they don't meet specific criteria. This method works on any Shopify plan and handles express checkouts flawlessly.
How to Implement a Checkout Validation Function:
Step 1: Tag Your Cafe Products
First, you need a way to identify your cafe items. Go to your Shopify admin, edit each cafe product, and add a consistent tag, like cafe. This tag will be used by the validation function.
Step 2: Deploy the Function (Developer Required)
This step requires a developer to scaffold and deploy a Shopify Function. They'll use the Shopify CLI with a command like shopify app generate extension --template cart_checkout_validation --flavor vanilla-js. Then, they'll add the following code into the respective files:
Input Query (src/cart_validations_generate_run.graphql):
query CartValidationsGenerateRunInput {
cart {
lines {
merchandise {
__typename
... on ProductVariant {
product { isCafeItem: hasAnyTag(tags: ["cafe"]) }
}
}
}
}
shop {
localTime {
duringCafeHours: timeBetween(startTime: "10:00:00", endTime: "15:00:00")
}
}
}
Function (src/cart_validations_generate_run.js):
export function cartValidationsGenerateRun(input) {
if (input.shop.localTime.duringCafeHours) {
return { operations: [] };
}
const hasCafeItem = input.cart.lines.some(
(line) =>
line.merchandise.__typename === "ProductVariant" &&
line.merchandise.product.isCafeItem
);
if (!hasCafeItem) {
return { operations: [] };
}
return {
operations: [
{
validationAdd: {
errors: [
{
message:
"Cafe items can only be ordered between 10:00 AM and 3:00 PM. Please remove them to continue.",
target: "$.cart",
},
],
},
},
],
};
}
After deployment, the function can be activated under Settings > Checkout in your Shopify admin.
Why this code is so good:
- It checks your shop's timezone (
shop.localTime), not the customer's browser time, preventing confusing discrepancies, as forgecro wisely pointed out. - It explicitly looks for products tagged
cafe. - It only triggers the error if a cafe item is in the cart outside the specified hours (10 AM - 3 PM).
- The error message is clear, guiding the customer on what to do.
Crucial Best Practices & Testing
Regardless of the solution you choose, the community emphasized a few critical best practices:
-
Test Thoroughly Around Cutoff Times: WefJoren and forgecro strongly advised running test orders just before and just after your 3 PM cutoff (e.g., 2:55 PM and 3:05 PM). Don't forget to test with real payment methods and express checkouts like Shop Pay, Apple Pay, or Google Pay, as these can sometimes behave differently.
-
Verify Store Timezone: If using a custom function, confirm your store's timezone is correctly set in Settings > General. This is vital for the
shop.localTimeto work as expected. -
Clear Customer Communication: Always display your cafe hours prominently on the cafe page, product pages, and in your pickup instructions. This manages customer expectations and reduces frustration if an order is blocked. As Ploqo suggested, "state the cafe hours on the cafe page and in your pickup instructions, so shoppers see the window before they order."
-
Monitor Initially: For the first week, make it a habit to quickly review order timestamps each morning. This helps you catch any unexpected edge cases related to timezones or payment methods before they become a bigger headache.
It's great to see how the Shopify community rallied to provide such comprehensive advice for carriec228! While Shopify doesn't have a built-in "hide by time of day" feature, these solutions offer robust ways to manage time-based product availability, ensuring you prevent those pesky refunds and keep your operations smooth. Whether you go with an app, Shopify Flow, or custom code, the key is to ensure the restriction happens where it truly matters: at checkout.

