liquid

Color swatch on collections page I Shopify

陌路散爱 提交于 2021-02-20 04:31:05
问题 I have a shopify store and I added a color swatch palette to my shopify collections page . How do I display only the colors that are in stock? http://gloria22x.myshopify.com/collections/alle-produkte?sort_by=manual Thanks, Alex {% for option in product.options %} {% if option == 'Color' %} {% assign index = forloop.index0 %} {% assign colorlist = '' %} {% assign color = '' %} {% for variant in product.variants %} {% capture color %} {{ variant.options[index] }} {% endcapture %} {% unless

Dotliquid cannot bind property of an object inside an array

▼魔方 西西 提交于 2021-02-11 12:47:30
问题 I have a .NET Core application that is using dotliquid. From the try online it looks like I can bind a property of an object that is inside an array. Like {{user.tasks[0].name}} where tasks is a collection of task object and name is property of the task . I have JSON model that would be the input to the template. I don't know the JSON structure during the design time. So I am converting JSON string into ExpandoObject . However, this does not work when I bind property of an object that is

Regex for matching a tag in a Liquid template : “>” inside html tag

寵の児 提交于 2021-02-10 06:49:07
问题 I have to write a match pattern for the body tag in a Liquid template. While matching HTML tags is pretty straightforward, I have the problem that HTML special character can be used inside the Liquid code. Example: <body class="template-{{ template | replace: '.', ' ' | truncatewords: 1, '' }}{% if promo %}has-promo{% endif %} {% if products.size > 1 %}has-related-products{% endif %} {% if settings.product-hover == 'quick-shop' %}has-quick-shop{% endif %} loading" > or simplified: <body {%

Using Jekyll, how do you alter an array's contents using a for loop?

二次信任 提交于 2021-02-08 09:57:25
问题 Say I have an array thingy.foo = ['abc', 'def'] in my scope. My goal is to be able to loop over all the items in thingy.foo and apply some conditional logic to it, overwriting the existing item in the array... Something like this: {% for item in thingy.foo %} {% assign thingy.foo[forloop.index0] = site.data.lookups[item] | default: item %} {% endfor %} What I am doing do the item is a bit irrelevant, the part I'm having issues with is updating the item in the array. The code compiles and runs

Using Jekyll, how do you alter an array's contents using a for loop?

我的未来我决定 提交于 2021-02-08 09:56:58
问题 Say I have an array thingy.foo = ['abc', 'def'] in my scope. My goal is to be able to loop over all the items in thingy.foo and apply some conditional logic to it, overwriting the existing item in the array... Something like this: {% for item in thingy.foo %} {% assign thingy.foo[forloop.index0] = site.data.lookups[item] | default: item %} {% endfor %} What I am doing do the item is a bit irrelevant, the part I'm having issues with is updating the item in the array. The code compiles and runs

Shopify trigger function on variant selection but don't override existing functionality

只愿长相守 提交于 2021-01-28 06:34:55
问题 I am using the 'Loft' theme on Shopify. When I select a variant on the product page, the them updates the SKU and the price to that variant I need more functionality than this, as I would like to show the dimensions of each variant using metafields. I have created a function and called it on variant select like this: jQuery(function($) { new Shopify.OptionSelectors('productSelect', { product: {{ product | json }}, onVariantSelected: selectCallback, enableHistoryState: true }); }); My function

Date comparison Logic / in Liquid Filter

◇◆丶佛笑我妖孽 提交于 2021-01-28 05:10:08
问题 I'm trying to add 30 days to a pre-order date and if today's date is later, display a text string and if not display another text string. Any ideas where I'm going wrong? {% assign assign pre_date = 259200 | plus: order.created_at | date: '%s' %} {% assign today_date = 'now' | date: '%s' %} {% if pre_date > today_date %} disply this {% else %} this {% endif %} 回答1: The date filter returns a string, even when you're using %s to get a number of seconds, so Shopify may be running into situations

Include Jekyll/Liquid code without rendering it

烂漫一生 提交于 2021-01-27 04:43:16
问题 Is it possible to {% include file.html %} without the tags inside it getting rendered? I've tried {% include file.html | escape_once %} which gives an error running it through {% raw %} {% include file.html %} {% endraw %} which gives {% include file.html %} (not surprisingly). I'm looking for something along the lines of {% include file.html | no_render %} The reason I can't put the raw tags inside file.html is that I'm trying to reuse it as a template (it's a bit of a hack). This would also

Include Jekyll/Liquid code without rendering it

折月煮酒 提交于 2021-01-27 04:42:11
问题 Is it possible to {% include file.html %} without the tags inside it getting rendered? I've tried {% include file.html | escape_once %} which gives an error running it through {% raw %} {% include file.html %} {% endraw %} which gives {% include file.html %} (not surprisingly). I'm looking for something along the lines of {% include file.html | no_render %} The reason I can't put the raw tags inside file.html is that I'm trying to reuse it as a template (it's a bit of a hack). This would also

Locomotive CMS: Dynamically Target content_types with Liquid Variable

守給你的承諾、 提交于 2020-12-15 07:15:50
问题 I'm building a custom navigation snippet in Locomotive CMS and I want content_type entries to be listed in the navigation along with pages. Specifically (and obviously) I only want entries listed if the content_type has a content_type_template set up. My plan was to set a handle (refereneced here but ultimately missing from the documentation) on the content_type_template page and then run the following logic when iterating through pages: {% assign myContentType = loopPage.handle %} {% for