In my Shopify App which I’m building with NodeJS + React, I would like to insert liquid code into the theme files of the shop.
I found this tutorial, but it only shows how to do it “manually”.
I thought about getting the theme file as a string using the Asset API, then inserting a liquid code using javascript native functions like .findIndex, .slice, etc etc. Is this the only way to insert code into theme files? Or is there an easier way?
I reckon that you’re not very familiarized with Javascript itself since this is a fairly basic API call, therefore I’d highly suggest getting proficient in React before diving into Shopify App developement, it will save you a lot of headache and make your progress much more smooth.
Unfortunately app development for Shopify is not much beginner-friendly, I feel you there.
Consider taking a look in Udemy courses for React/Node to gain a bit more of understanding of how it works and I promise you it’s going to be much more easy to understand!
Of course you’d need to use REGEX to target something like {{content_for_header }} as well, but that’s about it!
In Shopify dev-ing there’s a lot of “non-conventional/ideal” ways to do things, unfortunately.
Shopify’s support specifically for app developers is terrible as well, so feel free to reach out for anything you need, I’ll be happy to help.
res.status(200).json({ success: true });
} catch (error) {
console.error(“Failed to update header.liquid file:”, error);
res.status(500).json({ success: false, error: “Failed to update header.liquid file” });
}
}); this is my node js code, but when i i put call data not updating why? please any solution for it
I was using the same query till now but shopify has declared REST as legacy, so I was trying to use themeFileUpsert query in graphQL, but it says you need write_themes and write_themes_assets access scope which I have been trying to add in my TOML file but it throws an error saying that write_themes_assets is not a valid access scope, do you have any migration steps which can help me.