skip to Main Content

I am developing a Shopify Theme. The structure I have now is (excerpt):

Snippets

custom-message-snippet

Sections

custom-message-section

welcome-page-a-section

welcome-page-b-section

Templates

welcome-page-a-template

welcome-page-b-template

Custom message snippet uses settings that are in the custom-message-section, that is:

a) message

b) header text

I’d like for users to be able to add custom-message-snippet to welcome-page-a and welcome-page-b in a way that settings for both are different.

I can not render section ‘custom-message-section" inside welcome pages because it is not possible (and a workaround is nasty).

There are fifty welcome pages. Every welcome page is totally different.

My question is:

How to allow users to use custom-message-snippet in all welcome pages without copying and pasting custom-message-page setting schema to each and every welcome page?

3

Answers


  1. Short: You can’t.

    Long: Using storefront 2.0, you end you having blocks, which can be added manually to any template.

    Login or Signup to reply.
  2. combine custom-message-section to custom-message-snippet

    combine welcome-page-w+-template to welcome-page-template, you only need to have one template and schema set, the user will control the sections in schema selection.

    in template, use schema to select the page-content; this, defined by a bunch of if-else /switch statement.

    {% section "welcome-page-custom-message-section" %}
    {% section "welcome-page-content" %}
    

    in welcome-page-custom-message-section

    {% render "custom-message-snippet" with "string from welcome-page-section schema " %}
    

    create checkbox select schema for custom message to appear or not.

    Login or Signup to reply.
  3. It is possible if you have a little knowledge of Node.js and you’re using the Shopify CLI.
    Check the solution here: Shopify Section / Block Schema In A Separate File. It is possible 

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search