The documentation for the Commerce API gives the example payload below for adding items to a cart. How do I find the type and ID values for the product variants in my store configuration?

  "data": [
      "type": "product-variations--default",
      "id": "e8daecd7-6444-4d9a-9bd1-84dc5466dba7",
      "meta": {
        "quantity": 1

I eventually located these using the path https://mydomain.com/jsonapi/product-variations/default.

A call to https://mydomain.com/jsonapi exposes the end-points you can use, based on your product configuration. Mine looked like this:

        "product--default": {
            "href": "http:\/\/mydomain.com\/jsonapi\/products\/default"
        "product-attribute": {
            "href": "http:\/\/mydomain.com\/jsonapi\/product-attributes"
        "product-attribute-value--rate": {
            "href": "http:\/\/mydomain.com\/jsonapi\/product-attribute-values\/rate"
        "product-type": {
            "href": "http:\/\/mydomain.com\/jsonapi\/product-types"
        "product-variation--default": {
            "href": "http:\/\/mydomain.com\/jsonapi\/product-variations\/default"
        "product-variation-type": {
            "href": "http:\/\/mydomain.com\/jsonapi\/product-variation-types"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.