Ian at SSU
Ian at SSU

Reputation: 409

BigCommerce - Stencil - client configurable text value pair

Working on a Stencil theme that supports a third-party javascript widget. No problem passing product data to the script. The problem is I need to pass the client's license key and don't want to hardcode it in a template. The schema.json does not support a text field. Any idea how a store owner can set text configuration that is accessible via a yaml?

Upvotes: 0

Views: 161

Answers (2)

Ian at SSU
Ian at SSU

Reputation: 409

Since asking this question Stencil has implemented this feature.

Object Structure in schema.json: Text Examples

Upvotes: 0

thannes
thannes

Reputation: 778

Any reason setting the value in the config.json file and calling it into the template wouldn't work?

You would set this value in your config file like so.

"settings": {
   "my_license_key": "abcdefg",
   ....
}

Then call your value in a template.

<p>{{theme_settings.my_license_key}}</p>

This way you wouldn't need to include the YAML attribute on each page you need the value either.

Upvotes: 1

Related Questions