You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran in to this issue as well. You need to use the Storefront GraphQL API in order to retrieve the translations. I actually just wrote a PR #308 that allows you to use this library to make requests to the storefront api.
Here is how you would use the PR to get a product translations for french Canadian:
$shopify = \PHPShopify\ShopifySDK::config([
'AccessToken' => 'SHOPIFY_ADMIN_TOKEN',
'ShopUrl' => 'my-store.myshopify.com',
'StoreFrontAccessToken' => 'STOREFRONT_ACCESS_TOKEN'
]);
$query = <<<GQL
query getProductById(\$id: ID!) @inContext(country: CA, language: FR) {
product(id: \$id) {
id
title
handle
productType
tags
descriptionHtml
options {
id
name
values
}
}
}
GQL;
// product global id - 'gid://shopify/Product/123456789'
$variables = [
'id' => $productGID
];
$data = $shopify->GraphQL->storefront($query, null, null, $variables);
Shopify now appears to support translatable content for products, but I could not see that this is implemented in the code (or how to access it):
https://shopify.dev/docs/api/admin-graphql/2023-07/queries/translatableResource#section-examples
The text was updated successfully, but these errors were encountered: