Focusing on managing products, variants, and collections through the API.
Hi, So i'm going to use shopify as a storage for my products, I'm going to retrieve them by API in my .net app, I've created custom shopify app for it, retrieved access token and all seems to work as expected.
Except the recommendation endpoint, I'd like shopify to also return a recommended products for given product but when I call recommendation endpoint it returns me "forbidden".
Here the endpoint that I'm trying to call:
string apiUrl = $"{usersMyShopifyUrl}recommendations/products.json?product_id={product.Items.FirstOrDefault().Id}";
Solved! Go to the solution
This is an accepted solution.
Hey @Yevhen_Bardyn
You'll probably have more luck with the Storefront API instead of the AJAX API which is specifically designed for liquid stores to hit.
Scott | Developer Advocate @ Shopify
This is an accepted solution.
Hey @Yevhen_Bardyn
You'll probably have more luck with the Storefront API instead of the AJAX API which is specifically designed for liquid stores to hit.
Scott | Developer Advocate @ Shopify
Hey @SBD_ ,
Thanks for advice!
I'll try with Storefront API, and leave the results here.
So I've tried to use this object (copied straight from documentation):
query productRecommendations($productId: ID!) {
productRecommendations(productId: $productId) {
id
}
}
But graphQL returns the following error:
Field 'productRecommendations' doesn't exist on type 'QueryRoot'
I'm not sure what I'm missing here.
Additionally, I tried to use simple:
query getProductById($id: ID!) {
product(id: $id) {
title
}
}
From the same documentation and it worked just fine.
I made a few errors and wasn't really using storefront api, but after a few fixes everything works.
Thanks @SBD_ !