The Vue Storefront Essentials Course is now available! Learn More
Categories

Categories

Introduction

This section will cover the basics of categories and how to fetch the category data.

API Reference

You can find all available BigCommerce module methods and their description in the API Reference.

Fetching category data

To fetch the category data, you can use the getCategory method.

Fetching category by id is the most common use case.

import { sdk } from '~/sdk.config.ts';
const category = await sdk.bigcommerce.getCategory({ categoryId: 1 });

Category Tree

To fetch the category tree, you can use getCategory method, that returns the a category tree assigned to a channel. The relevant channel_id will be picked up automatically from the requests header.

import { sdk } from '~/sdk.config.ts';
const categoryTree = await sdk.bigcommerce.getCategoryTree();