I'm usng the "Commerce Cart API" module on my website to build a custom cart js layer. The problem i am facing is the purchased entity has a field_image field and I would like get the url of that images instead of the file id.

The json response of cart?_format=json looks like the following:

    "order_id": 9,
    "uuid": "a4604a10-f956-41e7-87f6-0d745b9345a4",
    "order_number": null,
    "store_id": 2,
    "order_items": [
        "order_item_id": 12,
        "uuid": "33bca307-2ee1-4be4-9599-9ecf3604f83c",
        "order_id": 9,
        "purchased_entity": {
          "variation_id": 1181,
          "uuid": "8112b394-5008-4209-85dc-a9deaf5dfea1",
          "type": "default",
          "product_id": 470,
          "sku": "345",
          "title": "Glade Aerosol 330",
          "list_price": {
            "number": "1.000000",
            "currency_code": "ARS",
            "formatted": "ARS 1,00"
          "price": {
            "number": "2.000000",
            "currency_code": "ARS",
            "formatted": "ARS 2,00"
          "resolved_price": {
            "number": "4.000000",
            "currency_code": "ARS",
            "formatted": "ARS 4,00"
          "field_imagenes": [

In brief what i'm tring to get is field_imagenes as an array of image urls. Is there a way to do it?

Thank you in advance!

1 Answer 1


It's reasonable for you to move to Commerce API?

That module is based on JSONA:API, therefore you should be able to get the data of relationship entities quite easily, look at include\relationship example on docs.

Plus, the headless system on Drupal mostly prefer json:api, including commerce itself


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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