diff --git a/lib/ecwid/index.ts b/lib/ecwid/index.ts index 679378e78c..c80ffa040f 100644 --- a/lib/ecwid/index.ts +++ b/lib/ecwid/index.ts @@ -725,7 +725,7 @@ export async function getCollections(): Promise { } export async function getCollection(handle: string): Promise { - let categoryId = handle.replace(/^.*?\-c/g, ''); + let categoryId = handle.replace(/.*(?<=-c)/, ''); const res = await ecwidFetch({ method: 'GET', @@ -751,7 +751,7 @@ export async function getCollectionProducts({ baseUrl: '/' }; - let categoryId = collection.replace(/^.*?\-c/g, ''); + let categoryId = collection.replace(/.*(?<=-c)/, ''); if (collection != 'hidden-homepage-carousel' && collection != 'hidden-homepage-featured-items') { query.categories = `${categoryId}`; @@ -805,7 +805,7 @@ export async function getProducts({ } export async function getProduct(handle: string): Promise { - let productId = handle.replace(/^.*?\-p/g, ''); + let productId = handle.replace(/.*(?<=-p)/, ''); const res = await ecwidFetch({ method: 'GET',