Skip to content

Commit 57de2d1

Browse files
authored
Fix assignment in render tag
Using `| escape` inside of a render tag is going to error in the newest version of Liquid's stricter error mode.
1 parent 28c420b commit 57de2d1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

snippets/product-variant-options.liquid

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,19 @@
5858
</span>
5959
{%- endcapture -%}
6060

61+
{% assign escaped_value = value | escape %}
62+
6163
{%- if picker_type == 'swatch' -%}
6264
{%- capture help_text -%}
63-
<span class="visually-hidden">{{ value | escape }}</span>
65+
<span class="visually-hidden">{{ escaped_value }}</span>
6466
{{ label_unavailable }}
6567
{%- endcapture -%}
68+
6669
{%
6770
render 'swatch-input',
6871
id: input_id,
6972
name: input_name,
70-
value: value | escape,
73+
value: escaped_value,
7174
swatch: value.swatch,
7275
product_form_id: product_form_id,
7376
checked: value.selected,
@@ -81,7 +84,7 @@
8184
type="radio"
8285
id="{{ input_id }}"
8386
name="{{ input_name | escape }}"
84-
value="{{ value | escape }}"
87+
value="{{ escaped_value }}"
8588
form="{{ product_form_id }}"
8689
{% if value.selected %}
8790
checked
@@ -98,7 +101,7 @@
98101
{%- elsif picker_type == 'dropdown' or picker_type == 'swatch_dropdown' -%}
99102
<option
100103
id="{{ input_id }}"
101-
value="{{ value | escape }}"
104+
value="{{ escaped_value }}"
102105
{% if value.selected %}
103106
selected="selected"
104107
{% endif %}

0 commit comments

Comments
 (0)