From d492e4716b862594c0ed59a9005d3cca2bfd1649 Mon Sep 17 00:00:00 2001 From: alexanderroese Date: Mon, 24 Jun 2024 21:42:22 +0200 Subject: [PATCH] get environment --- layout/theme.liquid | 2 +- snippets/shx-get-environment.liquid | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/layout/theme.liquid b/layout/theme.liquid index 04e947d..271c16c 100644 --- a/layout/theme.liquid +++ b/layout/theme.liquid @@ -59,7 +59,7 @@ endcapture %} - console.log("2", "url {{ shx_get_environment }}", "{{ shop.url }}") + console.log("2", "url {{ shx_get_environment }}", "{{ shop.permanent_domain }}") diff --git a/snippets/shx-get-environment.liquid b/snippets/shx-get-environment.liquid index a352c54..98896b3 100644 --- a/snippets/shx-get-environment.liquid +++ b/snippets/shx-get-environment.liquid @@ -1 +1,9 @@ -{{ shop.url }} \ No newline at end of file +{% assign domain = shop.permanent_domain %} + +{% if domain contains 'myshopify.com' %} + {% assign environment = 'development' %} +{% else %} + {% assign environment = 'production' %} +{% endif %} + +"{{ environment }}" \ No newline at end of file