Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/headless-components/stores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"@wix/headless-utils": "workspace:*",
"@wix/redirects": "^1.0.83",
"@wix/services-definitions": "^0.1.4",
"@wix/services-manager-react": "^0.1.26"
"@wix/services-manager-react": "^0.1.26",
"@wix/site": "^1.27.0"
},
"peerDependencies": {
"@wix/headless-components": "workspace:*"
Expand Down
7 changes: 6 additions & 1 deletion packages/headless-components/stores/src/react/Product.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ export interface ProductRootProps {
export const Root = (props: ProductRootProps): React.ReactNode => {
const { children, product, ...attrs } = props;

// NOT GOOD - this code is rendered also while the product list is being rendered
console.log('Product Root rendered', props.product);

return (
<CoreProduct.Root productServiceConfig={{ product: props.product }}>
<MediaGallery.Root
Expand Down Expand Up @@ -1715,7 +1718,8 @@ export const ProductActionAddToCart = React.forwardRef<
return null;
}

const onClick = addToCart;
const onClick = () => addToCart();

const disabled = !canAddToCart || isLoading;

if (asChild && children) {
Expand Down Expand Up @@ -1748,6 +1752,7 @@ export const ProductActionAddToCart = React.forwardRef<
loadingState={loadingState}
data-testid={TestIds.productActionAddToCart}
data-in-progress={isLoading}
onClick={onClick}
/>
);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as inventoryItemsV3 from '@wix/auto_sdk_stores_inventory-items-v-3';
import { CurrentCartServiceDefinition } from '@wix/headless-ecom/services';
import { MediaGalleryServiceDefinition } from '@wix/headless-media/services';
import { ProductServiceDefinition } from './product-service.js';
import { analytics } from '@wix/site';

type V3Product = productsV3.V3Product;
type Variant = productsV3.Variant;
Expand Down Expand Up @@ -571,6 +572,16 @@ export const SelectedVariantService =
modifiers?: Record<string, any>,
) => {
try {
console.log('SelectedVariantService addToCart trackEvent', modifiers);
/*
Use this to get the product and variant details for the trackEvent parameters.
Maybe it's better to do this in the component that calls the addToCart function, and propogate it downstream
Note that createLineItems is also doing this, so we need to make sure we're not duplicating the logic.
const prod = v3Product.get();
const variant = currentVariant.get();
*/
analytics.trackEvent('AddToCart', /* parameters */);

isLoading.set(true);
error.set(null);

Expand Down
29 changes: 28 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4898,6 +4898,13 @@ __metadata:
languageName: node
linkType: hard

"@wix/analytics@npm:1.5.0":
version: 1.5.0
resolution: "@wix/analytics@npm:1.5.0"
checksum: 10c0/64e808129e255615e0f2db3be4cd84fbe0fe58d023299d46442452a632d099aea390804bc3093121a9fa1c0cc7dadd93b73c57b85feb3db058ad6e86acb7b96b
languageName: node
linkType: hard

"@wix/astro-blog-demo@workspace:examples/astro-blog-demo":
version: 0.0.0-use.local
resolution: "@wix/astro-blog-demo@workspace:examples/astro-blog-demo"
Expand Down Expand Up @@ -7320,6 +7327,13 @@ __metadata:
languageName: node
linkType: hard

"@wix/consent-policy-manager@npm:1.10.0":
version: 1.10.0
resolution: "@wix/consent-policy-manager@npm:1.10.0"
checksum: 10c0/823c1309aaedf0e49f6ac18b55432b7af14cb6432326754238b19e8aff8b7a34b1e9e4b4403e8b130eaa21db61f0a2b7ada59b823719420924bb215bcc900e7f
languageName: node
linkType: hard

"@wix/dashboard@npm:^1.3.35, @wix/dashboard@npm:^1.3.36, @wix/dashboard@npm:^1.3.39":
version: 1.3.40
resolution: "@wix/dashboard@npm:1.3.40"
Expand Down Expand Up @@ -8475,6 +8489,7 @@ __metadata:
"@wix/redirects": "npm:^1.0.83"
"@wix/services-definitions": "npm:^0.1.4"
"@wix/services-manager-react": "npm:^0.1.26"
"@wix/site": "npm:^1.27.0"
jsdom: "npm:^26.1.0"
prettier: "npm:^3.4.2"
typescript: "npm:^5.8.3"
Expand Down Expand Up @@ -8892,7 +8907,7 @@ __metadata:
languageName: node
linkType: hard

"@wix/sdk-types@npm:1.14.0, @wix/sdk-types@npm:^1.13.35, @wix/sdk-types@npm:^1.13.39, @wix/sdk-types@npm:^1.13.41":
"@wix/sdk-types@npm:1.14.0, @wix/sdk-types@npm:^1.13.2, @wix/sdk-types@npm:^1.13.35, @wix/sdk-types@npm:^1.13.39, @wix/sdk-types@npm:^1.13.41":
version: 1.14.0
resolution: "@wix/sdk-types@npm:1.14.0"
dependencies:
Expand Down Expand Up @@ -8970,6 +8985,18 @@ __metadata:
languageName: node
linkType: hard

"@wix/site@npm:^1.27.0":
version: 1.27.0
resolution: "@wix/site@npm:1.27.0"
dependencies:
"@babel/runtime": "npm:^7.0.0"
"@wix/analytics": "npm:1.5.0"
"@wix/consent-policy-manager": "npm:1.10.0"
"@wix/sdk-types": "npm:^1.13.2"
checksum: 10c0/94af8fbfd53102c0553eaf67a6dcaa4b3727f9dfc9f0b32b750fd53ce9db9b3e7545865d875dde7b5906f19732f0c38c651cee9f8a127ae73a18e0836634db9d
languageName: node
linkType: hard

"@wix/stores@npm:^1.0.498":
version: 1.0.521
resolution: "@wix/stores@npm:1.0.521"
Expand Down
Loading