Re: Storefront products api not returning some products

Storefront products api not returning some products

junaid1112
Tourist
7 0 4

We are using storefront API to integrate our store with Rails BE. Some of products are not getting listed in the storefront get products API. There nothing seems wrong with the attributes of the product because I tried to make both products similiar, One is listing while the other is not. 

I also tried duplicating the product which was not listing, the new generated duplicate is appearing in the products list but not the actual one. This is strange! 

We are not able to identify the root cause of this issue, and it is causing a lot of inconvenience to our business operations.

 

Replies 3 (3)

ShopifyDevSup
Shopify Staff
1453 238 511

Hi @junaid1112 👋

 

I'd recommend checking whether the product is published to the app with SFAPI access. If it appears to be published but remains inaccessible with SFAPI, please contact us here using an account with permissions to the store/app and share examples for investigation. 

 

{ # Admin API
    product (id: "gid://shopify/Product/123"){
        publishedOnCurrentPublication
    }
}

 

Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

junaid1112
Tourist
7 0 4

Yes, It appears to be visible to current Publication. But it's still not visible in the products API. Should I try something else?

junaid1112_0-1681807780943.png

 

ShopifyDevSup
Shopify Staff
1453 238 511

It's unclear from the screenshot what request is being made. If the product is published (to the app that owns the storefront access token), please use a storefront access token from the same app with the below curl request. Alternatively, please reach out through this link using an account with permissions to the app & shop, and provide the team with examples of the exact request being made including the product ID. 

 

curl -L 'https://SHOP-NAME.myshopify.com/api/2023-04/graphql.json' \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Storefront-Access-Token: {STOREFRONT-ACCESS-TOKEN-FROM-SAME-APP}' \
-d '{"query":"{ product (id: \"gid://shopify/Product/123\"){ title } } " }'

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog