Retrieves a collection with the provided slug.
function getCollectionBySlug(
slug: string,
): Promise<GetCollectionBySlugResponse>;
Slug of the collection to retrieve.
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
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.