Skip to content

Commit

Permalink
PWA-2971: [bug]: Gallery item Add To Cart configurable product redire…
Browse files Browse the repository at this point in the history
…ct URL doesn't match tile URL

- use resourceUrl util to generate redirect link
  • Loading branch information
anthoula committed Nov 10, 2022
1 parent 6fc2f18 commit 6e959ee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/peregrine/lib/talons/Gallery/useAddToCartButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useHistory } from 'react-router-dom';

import { useCartContext } from '../../context/cart';
import { useEventingContext } from '../../context/eventing';
import resourceUrl from '../../util/makeUrl';
import operations from './addToCart.gql';

/**
Expand Down Expand Up @@ -91,7 +92,11 @@ export const useAddToCartButton = props => {

setIsLoading(false);
} else if (productType === 'ConfigurableProduct') {
history.push(`/${item.url_key}${urlSuffix || ''}`);
const productLink = resourceUrl(
`/${item.url_key}${urlSuffix || ''}`
);

history.push(productLink);
} else {
console.warn('Unsupported product type unable to handle.');
}
Expand Down

0 comments on commit 6e959ee

Please sign in to comment.