Skip to content

Sections

A section is one block of a storefront page. Each belongs to one theme and one channel, carries content per locale, and is drawn in the order the channel gives it.

Types

TypeWhat it draws
image_carouselA slider of images, each with its own link.
product_carouselProducts chosen by a filter, drawn as a slider.
category_carouselCategories chosen by a filter, drawn as a slider.
footer_linksThe footer link columns.
static_contentFree HTML and CSS.
services_contentThe service badges strip, each with an icon.

The type decides the fields a section carries. Section fields returns that field set as a schema together with the values currently held, which is enough to build an editor without hard-coding any type.

Two rules the storefront depends on

  • One footer per channel. A channel can hold at most one footer_links section; creating a second, or switching another section to that type, is rejected with 422.
  • The footer is drawn last. A reorder that places footer_links anywhere but the end has it moved back, and the response returns the order that was actually stored.

Staged edits

Nothing a client writes through the draft endpoints reaches shoppers until it is published:

StagedEndpointHeld in
Content, per localeStage editsdraftOptions on the translation
On/offStage statusdraftStatus
Render orderStage orderdraftSortOrder

hasDraft on a section is true while any of the three is set. Publish promotes every staged edit of a theme and channel at once; Discard throws them all away. Preview returns the theme as those staged edits would leave it.

Creating a section stages it switched off, so an unbuilt section is never shown. Writing published values directly — without the draft cycle — is what Update section does.

Media

Images and videos are uploaded first through Upload media, which returns a stored path. The client then records that path in the section's options through the draft or update endpoint. Uploading does not change what a section shows.

Endpoints

EndpointPurpose
List sectionsSections of a theme and channel, in render order
Get sectionOne section with its translations
Create sectionAdd a section
Update sectionWrite published values
Delete sectionRemove a section
Stage editsHold options as a draft
Stage statusStage on/off
Stage orderStage render order
Copy sectionCopy a section
PublishPromote staged edits
DiscardThrow staged edits away
Section fieldsField schema and current options
Upload mediaStore an image or video
PreviewTheme with staged edits applied

Permissions

ActionPermission
Read, fields, previewappearance.sections
Create, copyappearance.sections.create
Update, draft, status, order, publish, discard, mediaappearance.sections.edit
Deleteappearance.sections.delete

Released under the MIT License.