getCollectionBySlug( )


Retrieves a collection with the provided slug.

Permissions
Manage Stores - all permissions
Manage Products
Read Stores - all read permissions
Read Products
Manage Orders
Learn more about app permissions.
Method Declaration
Copy
function getCollectionBySlug(
  slug: string,
): Promise<GetCollectionBySlugResponse>;
Method Parameters
slugstringRequired

Slug of the collection to retrieve.

Returns
Return Type:Promise<GetCollectionBySlugResponse>
JavaScript
import { products } from "wix-stores.v2"; async function getCollectionBySlug(slug) { try { const result = await products.getCollectionBySlug(slug); return result; } catch (error) { console.error(error); // Handle the error } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?