Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I am calling the endpoint GET /admin/products.json but it seems the data is not including some additional info that I can get when data is exported to csv from the admin.
Some data that is not being included on the API response:
* cost price attribute
* status
* SEO description and page title
* Google Shopping data
How can I get it via API?
Hi @inuar
Aibek is here from Speedimize.io agency.
Welcome to Community.
The products have options. When sending an API request, the product options are also sent at the same time. For example, below. And there you can find the price.
"variants": [
{
"id": 808950810,
"product_id": 632910392,
"title": "Pink",
"price": "199.00",
"sku": "IPOD2008PINK",
"position": 1,
"inventory_policy": "continue",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": "shopify",
"option1": "Pink",
"option2": null,
"option3": null,
"created_at": "2021-02-17T19:22:04-05:00",
"updated_at": "2021-02-17T19:22:04-05:00",
"taxable": true,
"barcode": "1234_pink",
"grams": 567,
"image_id": 562641783,
"weight": 1.25,
"weight_unit": "lb",
"inventory_item_id": 808950810,
"inventory_quantity": 10,
"old_inventory_quantity": 10,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/808950810",
"presentment_prices": [
{
"price": {
"currency_code": "USD",
"amount": "199.00"
},
"compare_at_price": null
}
]
},
If there is a value for published_at, then the product is published, if there is no value, then it is not published.
* SEO description and page title
* Google Shopping data - such data is not received. They are configured in a separate liquid file social-meta-tags, where this data regarding SEO is registered. Inside this file, there is usually a check for products. That is, if it is a product template, then the title and all other data will change.
Hi @Anonymous
Thanks for the update. I've managed to get status after getting the last version (unstable of the API)
here is my product response.
(
[id] => 4529633558321
[title] => xxxxxxx
[body_html] => xxxxxx
[vendor] => Ferro 13
[product_type] => Wine
[created_at] => 2020-06-15T13:58:31+01:00
[handle] => sauvignon-ferro
[updated_at] => 2021-02-02T01:16:18+00:00
[published_at] => 2020-06-15T10:33:28+01:00
[template_suffix] =>
[status] => active
[published_scope] => web
[tags] => white
[admin_graphql_api_id] => gid://shopify/Product/4529633558643
[variants] => Array
(
[0] => Array
(
[id] => 31826232606835
[product_id] => 4529633558643
[title] => Default Title
[price] => 10.90
[sku] => N014898
[position] => 1
[inventory_policy] => deny
[compare_at_price] => 11.90
[fulfillment_service] => manual
[inventory_management] => shopify
[option1] => Default Title
[option2] =>
[option3] =>
[created_at] => 2020-06-15T13:58:32+01:00
[updated_at] => 2021-02-02T01:13:36+00:00
[taxable] => 1
[barcode] =>
[grams] => 1200
[image_id] =>
[weight] => 1.2
[weight_unit] => kg
[requires_shipping] => 1
[admin_graphql_api_id] => gid://shopify/ProductVariant/31826232606835
[presentment_prices] => Array
(
[0] => Array
(
[price] => Array
(
[currency_code] => GBP
[amount] => 10.90
)
[compare_at_price] => Array
(
[currency_code] => GBP
[amount] => 11.90
)
)
)
)
)
[options] => Array
(
[0] => Array
(
[id] => 5882923974771
[product_id] => 4529633558643
[name] => Title
[position] => 1
[values] => Array
(
[0] => Default Title
)
)
)
[images] => Array
(
[0] => Array
(
[id] => 14639690023027
[product_id] => 4529633558643
[position] => 1
[created_at] => 2020-06-16T10:22:02+01:00
[updated_at] => 2020-11-26T23:43:07+00:00
[alt] =>
[width] => 1080
[height] => 1350
[src] => https://cdn.shopify.com/s/files/xxxx
[variant_ids] => Array
(
)
[admin_graphql_api_id] => gid://shopify/ProductImage/14639690023027
)
)
[image] => Array
(
[id] => 14639690023027
[product_id] => 4529633558643
[position] => 1
[created_at] => 2020-06-16T10:22:02+01:00
[updated_at] => 2020-11-26T23:43:07+00:00
[alt] =>
[width] => 1080
[height] => 1350
[src] => https://cdn.shopify.com/s/xxxxxxx
[variant_ids] => Array
(
)
[admin_graphql_api_id] => gid://shopify/ProductImage/14639690023027
)
)
I can't see the cost attribute for this product.
Regarding the Google Shopping data, when exporting to CSV I get all these columns.
SEO Title | SEO Description | Google Shopping / Google Product Category | Google Shopping / Gender | Google Shopping / Age Group | Google Shopping / MPN | Google Shopping / AdWords Grouping | Google Shopping / AdWords Labels | Google Shopping / Condition | Google Shopping / Custom Product | Google Shopping / Custom Label 0 | Google Shopping / Custom Label 1 | Google Shopping / Custom Label 2 | Google Shopping / Custom Label 3 | Google Shopping / Custom Label 4 |
Hi @inuar
Thanks for getting back to me.
Maybe, do you mean "Cost Per Item"? In that case, you need to use Inventory Item: https://shopify.dev/docs/admin-api/rest/reference/inventory/inventoryitem#index-2021-01
Hope that helps you.
@Anonymous Yes that helped.
Thank you.
So glad to hear that!
If my solution helps you, can you please press like or accept the solution.
Thank you in advance!
The SEO title/description fields are stored in metafields. Same with the Google Shopping fields.
So to get/set programmatically you'd need to loop through these fields per Product ID.
The Shopping fields are not a "core" Shopify feature. However, there are some metafields which are added by the Google channel app which Shopify made.
Sidenote: I find that this Shopify "default" feed app is not robust in configurability or featureset, so not great for anything beyond the most basic feed management. DataFeedWatch or Feedonomics are heading in the right direction.
Anyway, here's an example of the metafields that Google channel app creates:
I would say likely these are what you're seeing when exporting to csv.
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024