cancel
Showing results for 
Search instead for 
Did you mean: 

REST api Bundle Product Issues - Price, Option Content

REST api Bundle Product Issues - Price, Option Content

Hello,

 

Me and my company are developing an Angular site for a client that communicates with Magento2 over Magento's build in REST api.

 

One of the requirements for the client is the use of lots of bundled products. However this doesn't seem to be implemented into the REST api very well.

 

We're having particular problems with price. The REST api does not communicate the lowest or highest price. infact it just computes as 0.

 

Using the endpoint 

{{API_URL}}/rest/{{STORE_VIEW_CODE}}/V1/products/{{BUNDLE_PRODUCT_SKU}}

I get this information

{
  "id": 90,
  "sku": "M10",
  "name": "Expedition Classic",
  "attribute_set_id": 11,
  "price": 0, // Notice price is 0
  "status": 1,
  "visibility": 4, // No matter the state of the product this NEVER changes
  "type_id": "bundle",
  "created_at": "2016-03-28 19:47:04",
  "updated_at": "2016-05-31 21:08:06",
  "weight": 0, // Weight is set, not communicating
  "extension_attributes": {
    "bundle_product_options": [
      {
        "option_id": 1,
        "title": "Hammock",
        "required": true,
        "type": "select",
        "position": 0,
        "sku": "M10",
        "product_links": [
          {
            "id": "1",
            "sku": "P15", // Not getting any information here
            "option_id": 1,
            "qty": 1,
            "position": 0,
            "is_default": true,
            "price": null,
            "price_type": null,
            "can_change_quantity": 0
          }
        ]
      },
      // More options here ...
    ]
  },
  "product_links": [
    //...
  ],
  "options": [],
  "media_gallery_entries": [
    //...
  ],
  "tier_prices": [],
  "custom_attributes": [
    //...
  ]
}

The things to note here are:

  1. The Price is always 0, no matter what
  2. The bundle options and their respective product links don't send with any media gallery entries which makes it very hard to update the UI with bundle choices without making a lot of API calls.

No matter what I do. I can't get the price to calculate. What I have been doing is querying every single default option SKU individually to get their price and then add them up at the end. This leads to a really slow experience when I'm trying to display price on a page like the catalog.

 

Is there any better way to get bundle product information from the API?