Skip to content

Categories

Organize products in a hierarchical catalog structure. Create nested categories, manage attributes, assign products automatically with rules, and control the product tree organization for navigation and filtering.

Basic CRUD Actions

Get Categories listing

View on Postman

Get a list of all product categories.

js
const categories = await $SDK.API.Core.Categories.getAll();
ts
import type { Categories } from '@tscommerce/sdk-typescript/resources/Core';

const categories: Categories[] = await $SDK.API.Core.Categories.getAll();
php
$categories = $sdk->core->categories->getAll();

Create new Category

View on Postman

Create a new product category.

js
const newCategory = await $SDK.API.Core.Categories.create({
  name: 'Electronics',
  slug: 'electronics',
  parent_id: null,
  active: true
});
ts
import type { Category, Categories } from '@tscommerce/sdk-typescript/resources/Core';

const newCategory: Category = await $SDK.API.Core.Categories.create({
  name: 'Electronics',
  slug: 'electronics',
  parent_id: null,
  active: true
});
php
$newCategory = $sdk->core->categories->create([
  'name' => 'Electronics',
  'slug' => 'electronics',
  'parent_id' => null,
  'active' => true
]);

Get Category

View on Postman

Get an existing category by ID.

js
const category = await $SDK.API.Core.Categories.get(1);
ts
import type { Category, Categories } from '@tscommerce/sdk-typescript/resources/Core';

const category: Category = await $SDK.API.Core.Categories.get(1);
php
$category = $sdk->core->categories->get(1);

Update Category

View on Postman

Update an existing product category.

js
const updated = await $SDK.API.Core.Categories.update(1, {
  name: 'Updated Electronics',
  active: true
});
ts
import type { Category, Categories } from '@tscommerce/sdk-typescript/resources/Core';

const updated: Category = await $SDK.API.Core.Categories.update(1, {
  name: 'Updated Electronics',
  active: true
});
php
$updated = $sdk->core->categories->update(1, [
  'name' => 'Updated Electronics',
  'active' => true
]);

Partial Update Category

View on Postman

Partially update specific fields of a category.

js
const updated = await $SDK.API.Core.Categories.partialUpdate(1, {
  name: 'New Name'
});
ts
import type { Category, Categories } from '@tscommerce/sdk-typescript/resources/Core';

const updated: Category = await $SDK.API.Core.Categories.partialUpdate(1, {
  name: 'New Name'
});
php
$updated = $sdk->core->categories->partialUpdate(1, [
  'name' => 'New Name'
]);

Delete Category

View on Postman

Delete a product category.

js
await $SDK.API.Core.Categories.delete(1);
ts
await $SDK.API.Core.Categories.delete(1);
php
$sdk->core->categories->delete(1);

Duplication

Duplicate Category

View on Postman

Create a copy of an existing category.

js
const duplicated = await $SDK.API.Core.Categories.duplicate(1);
ts
import type { Category, Categories } from '@tscommerce/sdk-typescript/resources/Core';

const duplicated: Category = await $SDK.API.Core.Categories.duplicate(1);
php
$duplicated = $sdk->core->categories->duplicate(1);

Category Hierarchy

Get Parent Category

View on Postman

Get the parent category of a specific category.

js
const parent = await $SDK.API.Core.Categories.getParent(5);
ts
import type { Category, Categories } from '@tscommerce/sdk-typescript/resources/Core';

const parent: Category = await $SDK.API.Core.Categories.getParent(5);
php
$parent = $sdk->core->categories->getParent(5);

Get Child Categories

View on Postman

Get all child categories of a specific category.

js
const childs = await $SDK.API.Core.Categories.getChilds(1);
ts
import type { Categories } from '@tscommerce/sdk-typescript/resources/Core';

const childs: Categories[] = await $SDK.API.Core.Categories.getChilds(1);
php
$childs = $sdk->core->categories->getChilds(1);

Category Attributes

Get Category Attributes

View on Postman

Get all attributes assigned to a category.

js
const attributes = await $SDK.API.Core.Categories.getAttributes(1);
ts
import type { Attributes } from '@tscommerce/sdk-typescript/resources/Core';

const attributes: Attributes[] = await $SDK.API.Core.Categories.getAttributes(1);
php
$attributes = $sdk->core->categories->getAttributes(1);

Assign Attribute to Category

View on Postman

Assign a specific attribute to a category.

js
await $SDK.API.Core.Categories.assignAttribute(1, 5, {
  value: 'default_value'
});
ts
await $SDK.API.Core.Categories.assignAttribute(1, 5, {
  value: 'default_value'
});
php
$sdk->core->categories->assignAttribute(1, 5, [
  'value' => 'default_value'
]);

Remove Attribute from Category

View on Postman

Remove an attribute assignment from a category.

js
await $SDK.API.Core.Categories.removeAttribute(1, 5);
ts
await $SDK.API.Core.Categories.removeAttribute(1, 5);
php
$sdk->core->categories->removeAttribute(1, 5);

Category Products

Get Category Products

View on Postman

Get all products assigned to a category.

js
const products = await $SDK.API.Core.Categories.getProducts(1);
ts
import type { Products } from '@tscommerce/sdk-typescript/resources/Core';

const products: Products[] = await $SDK.API.Core.Categories.getProducts(1);
php
$products = $sdk->core->categories->getProducts(1);

Assign Products to Category

View on Postman

Assign multiple products to a category.

js
await $SDK.API.Core.Categories.assignProducts(1, {
  product_ids: [10, 20, 30]
});
ts
await $SDK.API.Core.Categories.assignProducts(1, {
  product_ids: [10, 20, 30]
});
php
$sdk->core->categories->assignProducts(1, [
  'product_ids' => [10, 20, 30]
]);

Remove Products from Category

View on Postman

Remove products from a category assignment.

js
await $SDK.API.Core.Categories.removeProducts(1, {
  product_ids: [10, 20]
});
ts
await $SDK.API.Core.Categories.removeProducts(1, {
  product_ids: [10, 20]
});
php
$sdk->core->categories->removeProducts(1, [
  'product_ids' => [10, 20]
]);

Category Rules

Get All Category Rules

View on Postman

Get global list of all category rules.

js
const allRules = await $SDK.API.Core.Categories.getAllRules();
ts
import type { CategoryRules } from '@tscommerce/sdk-typescript/resources/Core';

const allRules: CategoryRules[] = await $SDK.API.Core.Categories.getAllRules();
php
$allRules = $sdk->core->categories->getAllRules();

Get Category Rules

View on Postman

Get all rules for a specific category.

js
const rules = await $SDK.API.Core.Categories.getRules(1);
ts
import type { CategoryRules } from '@tscommerce/sdk-typescript/resources/Core';

const rules: CategoryRules[] = await $SDK.API.Core.Categories.getRules(1);
php
$rules = $sdk->core->categories->getRules(1);

Create Category Rule

View on Postman

Create a new automatic assignment rule for a category.

js
const newRule = await $SDK.API.Core.Categories.createRule(1, {
  name: 'Auto-assign by brand',
  conditions: {
    brand_id: 5
  },
  active: true
});
ts
import type { CategoryRule, CategoryRules } from '@tscommerce/sdk-typescript/resources/Core';

const newRule: CategoryRule = await $SDK.API.Core.Categories.createRule(1, {
  name: 'Auto-assign by brand',
  conditions: {
    brand_id: 5
  },
  active: true
});
php
$newRule = $sdk->core->categories->createRule(1, [
  'name' => 'Auto-assign by brand',
  'conditions' => [
    'brand_id' => 5
  ],
  'active' => true
]);

Get Category Rule

View on Postman

Get a specific category rule by ID.

js
const rule = await $SDK.API.Core.Categories.getRule(1, 10);
ts
import type { CategoryRule, CategoryRules } from '@tscommerce/sdk-typescript/resources/Core';

const rule: CategoryRule = await $SDK.API.Core.Categories.getRule(1, 10);
php
$rule = $sdk->core->categories->getRule(1, 10);

Update Category Rule

View on Postman

Update an existing category rule.

js
const updated = await $SDK.API.Core.Categories.updateRule(1, 10, {
  name: 'Updated rule',
  active: false
});
ts
import type { CategoryRule, CategoryRules } from '@tscommerce/sdk-typescript/resources/Core';

const updated: CategoryRule = await $SDK.API.Core.Categories.updateRule(1, 10, {
  name: 'Updated rule',
  active: false
});
php
$updated = $sdk->core->categories->updateRule(1, 10, [
  'name' => 'Updated rule',
  'active' => false
]);

Delete Category Rule

View on Postman

Delete a category rule.

js
await $SDK.API.Core.Categories.deleteRule(1, 10);
ts
await $SDK.API.Core.Categories.deleteRule(1, 10);
php
$sdk->core->categories->deleteRule(1, 10);

Apply Category Rules

View on Postman

Execute all rules for a category to automatically assign products.

js
await $SDK.API.Core.Categories.applyRules(1);
ts
await $SDK.API.Core.Categories.applyRules(1);
php
$sdk->core->categories->applyRules(1);

Activate All Category Rules

View on Postman

Activate all rules for a specific category.

js
await $SDK.API.Core.Categories.activateAllRules(1);
ts
await $SDK.API.Core.Categories.activateAllRules(1);
php
$sdk->core->categories->activateAllRules(1);

Deactivate All Category Rules

View on Postman

Deactivate all rules for a specific category.

js
await $SDK.API.Core.Categories.deactivateAllRules(1);
ts
await $SDK.API.Core.Categories.deactivateAllRules(1);
php
$sdk->core->categories->deactivateAllRules(1);

Copyright © 2025-2025 TeamSystem S.p.A. - Built with ❤️ by TeamSystem Commerce