I have a current shipping script that deletes specific shipping methods based on some IF rules.
I have just added a new "SAME DAY" shipping method but I want it to be available only between 12AM-12PM.
So, I'm trying to add a new rule to the script, that checks the current hour.
The problem is I'm not sure how to "call" the current time in Ruby?
I guess the code should look something like this:
n = Time.now
if n.hour > 12
Input.shipping_rates.delete_if do |shipping_rate|
Time isn't available in Shopify Scripts so you won't be able to make use of it directly.
Is there any other way available to get the current time in Shopify scripts?
No. Time functions are not supported. Whatever you're trying to achieve will need to be handled in a different way.