From b1a29398fcde23e67c19bb579e714bcde39839cb Mon Sep 17 00:00:00 2001 From: Nathan Booker Date: Thu, 28 Mar 2024 10:01:25 -0500 Subject: [PATCH] Prefetch the cart link immediately after add-to-cart (#716) --- .changeset/fresh-lemons-lick.md | 5 +++++ .../(default)/compare/_components/add-to-cart-form.tsx | 7 ++++++- apps/core/components/product-card/cart.tsx | 7 ++++++- apps/core/components/product-form/index.tsx | 7 ++++++- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 .changeset/fresh-lemons-lick.md diff --git a/.changeset/fresh-lemons-lick.md b/.changeset/fresh-lemons-lick.md new file mode 100644 index 000000000..12be8dd93 --- /dev/null +++ b/.changeset/fresh-lemons-lick.md @@ -0,0 +1,5 @@ +--- +"@bigcommerce/catalyst-core": minor +--- + +Prefetch high-intent cart link immediately after add to cart action diff --git a/apps/core/app/[locale]/(default)/compare/_components/add-to-cart-form.tsx b/apps/core/app/[locale]/(default)/compare/_components/add-to-cart-form.tsx index 86c6d8582..ac4b35a13 100644 --- a/apps/core/app/[locale]/(default)/compare/_components/add-to-cart-form.tsx +++ b/apps/core/app/[locale]/(default)/compare/_components/add-to-cart-form.tsx @@ -40,7 +40,12 @@ export const AddToCartForm = ({ {t.rich('addedProductQuantity', { cartItems: quantity, cartLink: (chunks) => ( - + {chunks} ), diff --git a/apps/core/components/product-card/cart.tsx b/apps/core/components/product-card/cart.tsx index 3d4841b56..4d31b0230 100644 --- a/apps/core/components/product-card/cart.tsx +++ b/apps/core/components/product-card/cart.tsx @@ -56,7 +56,12 @@ export const Cart = ({ product }: { product: Partial }) => { {t.rich('addedProductQuantity', { cartItems: quantity, cartLink: (chunks) => ( - + {chunks} ), diff --git a/apps/core/components/product-form/index.tsx b/apps/core/components/product-form/index.tsx index 08a2871b4..b7f6a0caf 100644 --- a/apps/core/components/product-form/index.tsx +++ b/apps/core/components/product-form/index.tsx @@ -48,7 +48,12 @@ export const ProductForm = ({ product }: { product: Product }) => { {t.rich('addedProductQuantity', { cartItems: quantity, cartLink: (chunks) => ( - + {chunks} ),