Is there a method in Liquid that can tell me if a theme is the store's live theme or if it's unpublished?
I am wondering is something like {{ theme.role }} is possible (I know that this particular one was deprecated) and then I would get published or unpublished in return.
{{ theme.role }} - it's available for now, but not documented as far as I see. It returns:
main - for published theme
unpublished
Related
I have created a Static e-commerce site using Hugo.
Hugo ecommerce site
want to add products thro' Shopify admin, and get it reflected on my site.
I'm quite familiar with liquid templating. Kindly let me know how to achieve this?
So far,
I have created a Shopify store, added a theme and added one product.
I'm not looking to customize an existing theme, but completely remove that theme add my website theme in it.
You should be able to get your products using the Shopify API. This endpoint could be the one for you. From Hugo, you can then retrieve the products by getJson function with telling it the Shopify authorization header X-Shopify-Access-Token. Like this:
{{ $data := getJSON "https://your-store.myshopify.com/admin/api/2022-01/products.json" (dict "X-Shopify-Access-Token" "your-token") }}
{{ range $data }}
{{ . }}
{{ end }}
Just make sure that you've replaced both the your-store and your-token strings.
I have look for Shopify theme detector but I have no idea how it works and how to detect WordPress activated theme into theme folder.
You can access theme related info via the theme object
{{ theme.id }} - The ID of current active theme
{{ theme.name }} - The name of current active theme
This is a very nice cheat sheet you should be using: https://www.shopify.com/partners/shopify-cheat-sheet
What I am trying to do:
I am trying to create an app that inserts content to the merchant's product page.
It appears that an app extension into the merchant's Online Store is the most effective way to do this (see https://shopify.dev/docs/app-extensions/extension-areas#online-store/).
In order to display the content, I am trying to use either a snippet or a section. However, I cannot get either of them to work properly.
I have taken these steps for the snippet:
I have enabled Online store as an extension area within my app (see https://shopify.dev/tutorials/add-a-new-app-extension)
With the Online store extension enabled, I have created a new snippet and a new section with very basic liquid code <h2>{{ product.title }}</h2>
I have enabled my app into a test store on my Shopify Partner account
I have added the {% render 'shopify://apps/etc... %} code into the correct position within the product page
Problem:
The content is not rendered
I have even tried this with the Sections Compatible version of the Debut template (see https://shopify.dev/tutorials/develop-theme-get-started-with-online-store-design-experience). Still nothing.
Is someone able to point me in the right direction here?
I want to link the logo of my site (in my main header) to the homepage of my store. I could do so by linking to the absolute URL (e.g., https://www.example.com), but that doesn't work when I'm testing on a development server that isn't hooked up to my domain name.
I know that I can link to pages using <a href="{{ pages.example.url }}">, where example is the page I want to link to. But using <a href="{{ pages.index.url }}"> doesn't seem to work — I'm assuming because index is not actually considered a page.
Is there an easy way to link to my store's homepage using a liquid tag?
You can use {{ shop.url }} as listed on this variable cheat sheet and in the Shopify developer reference.
Returns the full URL of a shop.
http://johns-apparel.com
Homepage
You also have the option of using the secure version {{ shop.secure_url }}
Returns the full URL of a shop prepended by the https protocol.
https://johns-apparel.com
Homepage
I also found in a quick test that it will also return the preview URL when previewing an unpublished page e.g. k29ijan0ye0r5g7k-51325174.shopifypreview.com
I figured it out, for those curious: Just link to "/". So, a link to the homepage of your site should appear as follows in your header.liquid file:
Link
Link This doesn't work for multilanguage stores.
I think better solution is: {{ routes.root_url }}
I import my ads from eBay to Shopify (https://asiasell.com.au). In the product descriptions in the Shopify site I want to display only the text that is NOT related to eBay. I think if I do the opposite, hide eBay related text, then google might think I'm trying to hide keywords. It's a couple of paragraphs I want to NOT show. I'm going to guess that I add code to the timber.scss.liquid file. Thanks!
Like the comments say you question is very edgy in the sense that this isn't exactly about programming. However I would like to see what you've tried. For now I can just answer your question with Sudo.
You need to first find the product.liquid (I don't know what theme you're using but this is just general) and you need to do something like
{% assign description_text = 'something that is in that text' %}
{% if product.description contains {{ description_text }} %}
hide // this actually adds the class hide to this product
{% endif %}
Then in css somewhere you can do:
.hide {
display: none;
}
If you ever need help with something like this then you can use the Shopify forum. To be franlky honest I don't see why those questions are accepted on Stack when Shopify have a whole forum for developers to discuss coding in liquid specifcally for Shopify.