What are the available storefront section parameters?

Sections can be easily parameterised. This brings more flexibility and removes further duplication.

Using parameters in Sections is quick, easy and powerful. Follow the steps below to create and use a Section:

 

Step 1 - Adding parameters to the Section file

To add parameters to the Section file, simply replace the data with a parameter name. You don't have to specify or declare the parameters elsewhere in the Section

For example, let's say that within your example.twig file, you are using a 'Splide' carousel as follows:

 

Before parameterisation:

<div class="splide">
    {% set items = block_items("homepage.carousel", 3, {
        sizes: { large: { width 1124. height: 748} } 
    }) %}
</div>

After parameterisation:

<div class="splide">
    {% set items = block_items(block, 3, {
        sizes: sizes
    }) %}
</div>

 

Step 2 - Using an instance of a Section with parameters

Use the 'with' functionality to include parameters when you call a section.

For example

<div>
    {% section "example" with {block: "homepage.image", width: 1124, height: 748 } %}
</div>

Articles in this section

Was this article helpful?
0 out of 0 found this helpful