capabilities.work

Upsert Product Category

A 3-step recipe with WooCommerce. We can help you get access.

Recipe · 3 steps

Upsert Product Category

Upsert a product category, creating it only when it is missing.

  1. Search existing product categories for one matching the supplied name, returning at most one result.
  2. Read the matched category to confirm its current name and slug.
  3. Create a new product category when no existing category matched the name.
What you'll need to have ready
  • categoryName: Name of the category to find or create.
  • categorySlug: Optional URL-friendly slug to use when creating the category.
  • categoryDescription: Optional description to use when creating the category.
For your developer

Arazzo workflow woocommerce:upsert-category, 3 operations: listProductCategories → getProductCategory → createProductCategory. Specs on APIs.io.