Retrieving Current Time in Cart and Checkout Validation API

I noticed that the LocalTime type in the schema.graphql file for Shopify Functions is designed primarily for comparing given times and dates. However, it does not include a direct field or method to retrieve the current time.

This limitation poses challenges in scenarios where real-time operations or validations depend on the current time. Adding a new field to the LocalTime type to fetch the current time directly would greatly enhance functionality and simplify use cases like time-based logic in custom Shopify Functions.

Hi Amal,

I’ve connected with our product team on this and it appears that this limitation is intentional. All inputs must be provided to the function - it cannot pull anything from its environment, such as the current time, as this would mean that the same input could produce different outputs.

@AMaL Can you describe more about your use case? What sort of time precision would be needed to achieve your goals?