Hey folks, I hope everyone is well.
We have a specific “Saturday delivery” shipping option which a customer can use on a Friday to ensure next day delivery (at an increased shipping cost to us and the customer), however ideally I’d like to use scripts to hide this shipping option on every other day other than Friday, when it should be used.
Can anyone help me generate a code which will do this? I’d really appreciate it.
Thanks so much!
1 Like
Hi @UK_Aspire_Vendo
Are you on Shopify Plus? If not, there won’t be a way to do it other than writing a Shopify Script for shipping at checkout.
We are, hence why I’m looking to seek help for a ruby code to apply the above!
Writing the script per se would need some work, however if you are familiar with the rest and looking just for a way to fetch the date, this thread contains quite a lot of info.
Let me know if that helps!
Yeah I saw that thread, to which it looks like an utter foreign language to me, which is why I reached out on here.
The pseudo-code required here is as follows (considering your shipping method for Saturday should allows be published):
Get current day of week
If day equal to Friday
{ don’t hide the shipping method for next day}
else
{ hide the shipping method for next day}
I believe this is what you have in mind in terms of logic? If yes, we could assist with that should you want this done.
That’s basically it yes - however we’d like it to only show for customers NOT tagged with wholesale, as that shipping method is already hidden regardless of what day of the week it is in a script we already have running.
That’s good to mention, you can only have one Shopify script for shipping running at any given time.
So the logic should be embedded inside that tag detection, so that would be:
if customer NOT tagged with wholesale
Get current day of week
If day equal to Friday
{ unhide the shipping method for next day}
endif
else
continue normally
endif
Let me know if accurate!
Now, this can be easily done using the BeSure Checkout Rules app, even if you are on Shopify Basic plan. After getting the app, here are the steps.
- Create a rule for “hide shipping methods”.
- Inside the rule, select the condition of “day of the week is not” and select for example, Friday.
- Then write the shipping method name which you want to hide on all other days besides Friday, for example, “Saturday delivery”. Click on create rule and done.
This rule will hide “Saturday delivery” on all other days besides Friday. Hope this helps. Cheers!
1 Like