FabricioG
FabricioG

Reputation: 3320

Accessing settings json file in shopify from JS or product liquid page

I check this and it wasn't the same as my question: Editing JSON data from within a shopify liquid page

Currently I have a file settings_data.json in my theme. This file has a specific field called "product_form_style" there is a specific field I need to edit here from one product template titled: product_custom_liquid

According to some scarce resource I read this would work:

{% settings.product_form_style == 'my value' %}

This however gives an error: "Liquid syntax error: Unknown tag 'settings'"

The official documentation says I can access it with ajax or jquery from js however it doesn't give any examples. It only says it can be done but I have no idea how.

The basic idea is if product template is 'product_custom' then change settings product_form_style == true.

Obviously the above is not correct syntax. Just an example.

Upvotes: 1

Views: 1869

Answers (1)

drip
drip

Reputation: 12933

You can't modify the settings_data.json from the front-end without using an APP.

If you could modify it without any authentication this would have been a huge security issue and anyone could modify it.

settings_data.json is modified only when you save something in your Customize panel. For any other way you will need a Private app or some App to do so.

In addition you can't modify files in any way from the liquid code as well. The liquid template language only outputs data, it can't modify that data without the use of some kind of an APP.

Upvotes: 1

Related Questions