mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 05:56:59 +00:00
feat(poc): fix parent id
This commit is contained in:
parent
46e003196f
commit
b56e4828e3
@ -6,7 +6,7 @@ import { useRouter, useSearchParams } from 'next/navigation';
|
|||||||
import { useEffect, useState, useTransition } from 'react';
|
import { useEffect, useState, useTransition } from 'react';
|
||||||
|
|
||||||
import LoadingDots from 'components/loading-dots';
|
import LoadingDots from 'components/loading-dots';
|
||||||
import { ProductVariant } from 'lib/shopify/types';
|
import { ProductVariant } from 'lib/shopware/types';
|
||||||
|
|
||||||
export function AddToCart({
|
export function AddToCart({
|
||||||
variants,
|
variants,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { ProductOption, ProductVariant } from 'lib/shopify/types';
|
import { ProductOption, ProductVariant } from 'lib/shopware/types';
|
||||||
import { createUrl } from 'lib/utils';
|
import { createUrl } from 'lib/utils';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
@ -129,7 +129,7 @@ export async function getSearchCollectionProducts(params?: {
|
|||||||
const searchCriteria = { ...criteria, ...sorting };
|
const searchCriteria = { ...criteria, ...sorting };
|
||||||
|
|
||||||
const search = await requestSearchCollectionProducts(searchCriteria);
|
const search = await requestSearchCollectionProducts(searchCriteria);
|
||||||
if (search) {
|
if (useSeoUrls && search) {
|
||||||
search.elements = await changeVariantUrlToParentUrl(search);
|
search.elements = await changeVariantUrlToParentUrl(search);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ export function transformProduct(item: ExtendedProduct): Product {
|
|||||||
const productOptions = transformOptions(item);
|
const productOptions = transformOptions(item);
|
||||||
const productVariants = transformVariants(item);
|
const productVariants = transformVariants(item);
|
||||||
|
|
||||||
let path = item.id ? item.id : '';
|
let path = item.parentId ?? item.id ?? '';
|
||||||
if (useSeoUrls) {
|
if (useSeoUrls) {
|
||||||
path =
|
path =
|
||||||
item.seoUrls && item.seoUrls.length > 0 && item.seoUrls[0] && item.seoUrls[0].seoPathInfo
|
item.seoUrls && item.seoUrls.length > 0 && item.seoUrls[0] && item.seoUrls[0].seoPathInfo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user