--- url: /reference/items/FetchShopifySection/examples.md --- # Examples ::: tip These examples run against a Shopify storefront using the [Section Rendering API](https://shopify.dev/docs/api/ajax/section-rendering), so they are shown as code rather than live playgrounds. See the [`Fetch` examples](../Fetch/examples.md) for runnable demonstrations of the inherited behaviour. ::: ## Sorting a collection Refresh the product grid and the results count when the customer picks a sort order. The `href` keeps the section IDs out of it, so it stays a working link without JavaScript. ::: code-group ```liquid [collection.liquid] Sort by price {% comment %} `{% section %}` already outputs the `shopify-section-*` wrapper matched by id. {% endcomment %} {% section 'main-collection-product-grid' %} {% section 'collection-results-count' %} ``` ```ts [app.ts] import { registerComponent } from '@studiometa/js-toolkit'; import { FetchShopifySection } from '@studiometa/ui'; registerComponent(FetchShopifySection); ``` ::: ## Faceted filtering with a form Use a `
` so the selected facets are appended to the URL automatically; `FetchShopifySection` adds the `sections` parameter on top. A loader is shown while the sections refresh, using the inherited [`Action`](../Action/index.md) and [`Transition`](../Transition/index.md) components. ::: code-group ```liquid [collection.liquid] {% for filter in collection.filters %} {% render 'facet', filter: filter %} {% endfor %}
Loading…
{% comment %} `{% section %}` already outputs the `shopify-section-*` wrapper matched by id. {% endcomment %} {% section 'main-collection-product-grid' %} ``` ```ts [app.ts] import { registerComponent } from '@studiometa/js-toolkit'; import { Action, FetchShopifySection, Transition } from '@studiometa/ui'; registerComponent(Action); registerComponent(FetchShopifySection); registerComponent(Transition); ``` ::: ::: tip Changing a facet fires a native `change` event that bubbles to the form, where the [`Action`](../Action/index.md) binding calls `requestSubmit()` to trigger the request — no submit button needed once JavaScript runs. Keep the `