52.4k views
1 vote
Your client wants to add new content to their storefront. This content requires custom backend functionality. What is the best way to accomplish this?

a. Create a new Liquid template to display the content and build additional functionality with JavaScript
b. Use Liquid to return any necessary data as JSON and use JavaScript to build additional functionality
c. Build a private app and use a script resource to display the content
d. Build a private app and use JavaScript and Liquid to display the content

1 Answer

6 votes

Final answer:

The best way to add new content that requires custom backend functionality to a storefront is to use Liquid to return necessary data as JSON and employ JavaScript to build additional functionality. This approach provides a scalable and smooth integration between backend processing and front-end presentation.

Step-by-step explanation:

When your client wants to add new content to their storefront that requires custom backend functionality, the best approach can vary depending on the specifics of the required functionality and the content. However, generally speaking, option b provides a strong solution: Use Liquid to return necessary data as JSON and use JavaScript to build additional functionality. This approach leverages the power of Shopify's templating language, Liquid, to handle data processing and uses JavaScript to manipulate and present the data on the front end. Employing JSON as an intermediary data format makes the integration between the backend and frontend smooth and provides scalability for more complex interactions.

Option A might be a solution for simpler changes that don't require significant backend alterations. Options c and d, which involve building a private app and utilizing script resources or a combination of JavaScript and Liquid, could be more appropriate for very complex or high-stakes changes that warrant the infrastructure of a separate application.

User Dunnry
by
8.6k points