shopify-shortcodes
shopify-shortcodes copied to clipboard
Use of the global Shopify template variable sometimes causes conflicts.
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!
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