Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: Some attributes not returning from product endpoint

Some attributes not returning from product endpoint

inuar
Shopify Partner
14 0 1

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?

Nei Santos
nei@inuartech.com
Replies 6 (6)

Not applicable

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
            }
          ]
        },

 

Status does not come as a response. The status is used when sending an API request to get certain products. As we understand, you are probably looking for the status of the product in the plan published or not. For the status, in this case, use this: 
published_at

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.

https://shopify.dev/docs/admin-api/rest/reference/products/product#index-2021-01 - here you can find, how you can see what response comes when sending an API request to /admin/products 
 
Hope this information will help you. 
 
Kind Regards.
 
 
inuar
Shopify Partner
14 0 1

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.
Screenshot 2021-02-22 at 09.02.05.png

 

Regarding the Google Shopping data, when exporting to CSV I get all these columns.

 

SEO TitleSEO DescriptionGoogle Shopping / Google Product CategoryGoogle Shopping / GenderGoogle Shopping / Age GroupGoogle Shopping / MPNGoogle Shopping / AdWords GroupingGoogle Shopping / AdWords LabelsGoogle Shopping / ConditionGoogle Shopping / Custom ProductGoogle Shopping / Custom Label 0Google Shopping / Custom Label 1Google Shopping / Custom Label 2Google Shopping / Custom Label 3Google Shopping / Custom Label 4

 

Nei Santos
nei@inuartech.com
Not applicable

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. 

 

 

 
inuar
Shopify Partner
14 0 1

@Anonymous Yes that helped.

 

Thank you. 

Nei Santos
nei@inuartech.com
Not applicable

So glad to hear that! 

 

If my solution helps you, can you please press like or accept the solution.

 

Thank you in advance!

KieranR
Shopify Partner
398 34 121

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:

KieranR_0-1614922881275.png

I would say likely these are what you're seeing when exporting to csv.

Part time Shopify SEO, based in NZ. Sometimes freelance outside the 9-5.