Skip to content

createAdminAppearanceSectionDraft

Holds a section's content as an unpublished draft for one locale. The storefront keeps drawing the published content until createAdminAppearanceSectionPublish promotes it, and adminAppearanceSectionPreview shows what it would look like meanwhile.

Input fields

FieldTypeRequiredDescription
sectionIdIntYesSection the draft belongs to.
localeStringNoLocale the options belong to. Falls back to the channel locale.
optionsIterableYesThe full option set for the locale, shaped by the section's type.

Payload fields

FieldTypeDescription
sectionIdIntSection the draft belongs to.
localeStringLocale the draft was written for.
hasDraftBooleanWhether the section now holds any staged edit.
messageStringConfirmation text.

Use cases

  • Autosave an editor — send the whole option set on each change; the draft is replaced, so the last call wins.
  • Translate before going live — stage each locale separately, then publish once and every locale goes live together.

Best practices

  • Send the complete option set. The draft replaces the previous one rather than merging, so a partial input drops the fields it omits — read current values from adminAppearanceSectionFields first.
  • Do not select id on the payload. This result is an action outcome with no resource route; sectionId identifies it.
  • Staging content does not switch a section on.

Permissions

Requires appearance.sections.edit.

Released under the MIT License.