Skip to main content
Replaces a product category’s media. When media is provided, the entire existing gallery is swapped for the new list; when icon is provided, the existing icon image is swapped (pass null to clear it). Omitted fields are left untouched. At most one image keeps is_thumbnail and one keeps is_banner — the first flagged entry wins and later flags are silently dropped. Usually invoked through the createProductCategoryWithImagesWorkflow, updateProductCategoryWithImagesWorkflow, and deleteProductCategoryWithImagesWorkflow wrappers behind the /admin/product-categories routes.

Usage

import { setCategoryImagesWorkflow } from "@mercurjs/core/workflows"

await setCategoryImagesWorkflow(container).run({
  input: {
    category_id: "pcat_123",
    media: [
      { url: "https://cdn.example.com/hero.jpg", is_banner: true },
      { url: "https://cdn.example.com/thumb.jpg", is_thumbnail: true },
    ],
    icon: "https://cdn.example.com/icon.svg",
  },
})

Input

category_id
string
required
The category whose images are replaced.
media
CategoryMediaInput[]
New gallery; replaces all existing non-icon images (pass [] to clear).
icon
string | null
New icon URL; null removes the current icon, omit to keep it.

Result

result
void
No return value.