Add Country support to Programmable app

It would be great if you could add the option to Programmable to detect the visitor’s country, so we can dynamically show information based on that.

I would mainly use this to let customers know about shipping time to their country.

Eg. “Shipping to USA takes 10-15 days”.
Where the backend code would be something like: "Shipping to #{COUNTRY} takes #{COUNTRY(USA,“10-15”;CA,“15-20”)

Of course, this could be used for other things too…

Bonus:
Here are some Programmable codes that for some reason aren’t shown in the document section:
Date: “#{DATE}”
5 Days: “#{DATE(DAYS(5))}”
DATE(HOURS(2), “mm-ss”) : “#{DATE(MINUTES(2),‘mmmm/dd HH:MM’)}”
Random: “#{REFRESH(RANDOM(35,55), 1)}”
today: #{TODAY(‘mmm, mm/dd/yyyy YY’)}
today live: #{REFRESH(TODAY(), 1)}
LIVE: “#{REFRESH(LIVE(1500,1600), 1)}”
TIME NOW: #{NOW()}
LIVE TIME NOW updated every 1s: => #{REFRESH(NOW(), 1)}

1 Like

Amazing suggestion, I think that can be done for sure will see how long it will take to roll out something like that,

"Shipping to #{COUNTRY} takes #{COUNTRY(USA,“10-15”;CA,“15-20”)}

I don’t think it will be rolled out exactly like that though…

  • #{COUNTRY} seems good logic and would fit with existing syntax.

  • #{COUNTRY(USA,“10-15”;CA,“15-20”)}: I think can be done like this:
    #{if (COUNTRY=="CA") return "10-15";else if (COUNTRY=="USA") return "15-20";else return "30+"}

Which reads as:

    #{
      if (COUNTRY=="CA") 
        return "10-15";
      else if (COUNTRY=="USA") 
        return "15-20";
      else 
        return "30+"
    }

Because after all Programmable can parse and read proper Javascript codes, in other words, you can use whatever libraries, functionalities within its syntax…

We will see how it works out, and will update this thread once have some updates,

And thank you for the suggestion on improving the docs we are working on improving them regularly,

@yassine

1 Like