I have a new shopify account and have added 27 products split between 2 collections.
When I run a query to get productRecommendations using a productId through the Storefront API, I get an empty array back. Having read the docs about how the recommendation logic works, it should fallback to returning products in the same collection, which it doesn't appear to be doing.
My query looks like this
const GET_PRODUCT_RECOMMENDATIONS = gql`
query($productId: ID!) {
productRecommendations(productId: $productId) {
id
title
}
}
`;
const { data } = await apolloClient.query({
query: GET_PRODUCT_RECOMMENDATIONS,
variables: {
productId: 'xxxxxx',
},
});
And the result is data.productRecommendations is an empty array. Note I pass in a productId that belongs to a product in a collection.
Is this a bug in the API?
Hey @CaribouCode
Can you provide the product ID you used for this?
Kevin_A | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
@Kevin_A An example product ID I am having this issue with is: Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0LzU5NTkzODgxMDI4NTY=
I've had a chance to take a further look at this issue, and unfortunately the productRecommendations query only works as expected on Shopify plans higher than lite.
I've recorded the issue on your behalf to help influence product development in the StoreFront API.
Regards,
John
User | Count |
---|---|
24 | |
8 | |
7 | |
4 | |
4 |