shopify-shortcodes icon indicating copy to clipboard operation
shopify-shortcodes copied to clipboard

Use of the global Shopify template variable sometimes causes conflicts.

Open VeeDoubleYuh opened this issue 5 years ago • 1 comments

Hi there,

There is an issue where the template variable in the shortcode code can override other uses of this global variable in other code.

For example, our site is using s-template-{{ template.name | handle }} to set a class on the body of every page to determine what template is being loaded. We ran into an issue where sometimes the liquid above would produce nothing, and therefore scripts that targeted that class would not load in. After talking with Shopify support and a 3rd party developer, they finally found that renaming the template variable in the shortcode.liquid file removed the issue and still allowed the shortcodes to function.

TL;DR: Please rename your template variable to something less generic in shortcode.liquid

Thanks!

VeeDoubleYuh avatar Nov 11 '19 21:11 VeeDoubleYuh

This fixed our exact issue, thank you. We realized our body class was getting set to "template-" but we couldn't figure out what was nulling it

orsicreative avatar Nov 19 '19 14:11 orsicreative