0

Hi I have an issue with getting data about items in order, my order contain 1 row (one item) but in JSON I have 2 duplicated items with the same SKU but one with product_type=configurable and other with product_type=simple.And they haven't the same price. My Question is how we can get Items data (SKU,Qty,Price) in order without any risk of duplicated data?

    {
   "base_currency_code": "AUD",
   "base_discount_amount": 0,
   "base_grand_total": 145.8,
   "base_discount_tax_compensation_amount": 0,
   "base_shipping_amount": 5,
   "base_shipping_discount_amount": 0,
   "base_shipping_discount_tax_compensation_amnt": 0,
   "base_shipping_incl_tax": 5,
   "base_shipping_tax_amount": 0,
   "base_subtotal": 128,
   "base_subtotal_incl_tax": 140.8,
   "base_tax_amount": 12.8,
   "base_total_due": 145.8,
   "base_to_global_rate": 1,
   "base_to_order_rate": 1,
   "billing_address_id": 20,
   "created_at": "2019-03-18 23:33:17",
   "customer_email": "xxx@xxx.com",
   "customer_group_id": 0,
   "customer_is_guest": 1,
   "customer_note_notify": 0,
   "discount_amount": 0,
   "entity_id": 10,
   "global_currency_code": "AUD",
   "grand_total": 145.8,
   "discount_tax_compensation_amount": 0,
   "increment_id": "500000012",
   "is_virtual": 0,
   "order_currency_code": "AUD",
   "protect_code": "5f1d9351b5e81b1e1f231e33f62c0263",
   "quote_id": 14,
   "shipping_amount": 5,
   "shipping_description": "Flat Rate - Fixed",
   "shipping_discount_amount": 0,
   "shipping_discount_tax_compensation_amount": 0,
   "shipping_incl_tax": 5,
   "shipping_tax_amount": 0,
   "state": "new",
   "status": "pending",
   "store_currency_code": "AUD",
   "store_id": 1,
   "store_name": "Main Website\nMain Website Store\n",
   "store_to_base_rate": 0,
   "store_to_order_rate": 0,
   "subtotal": 128,
   "subtotal_incl_tax": 140.8,
   "tax_amount": 12.8,
   "total_due": 145.8,
   "total_item_count": 1,
   "total_qty_ordered": 1,
   "updated_at": "2019-03-18 23:33:17",
   "weight": 4.079,
   "items":    [
            {
         "amount_refunded": 0,
         "base_amount_refunded": 0,
         "base_discount_amount": 0,
         "base_discount_invoiced": 0,
         "base_discount_tax_compensation_amount": 0,
         "base_original_price": 128,
         "base_price": 128,
         "base_price_incl_tax": 140.8,
         "base_row_invoiced": 0,
         "base_row_total": 128,
         "base_row_total_incl_tax": 140.8,
         "base_tax_amount": 12.8,
         "base_tax_invoiced": 0,
         "created_at": "2019-03-18 23:33:17",
         "discount_amount": 0,
         "discount_invoiced": 0,
         "discount_percent": 0,
         "free_shipping": 0,
         "discount_tax_compensation_amount": 0,
         "is_qty_decimal": 0,
         "is_virtual": 0,
         "item_id": 27,
         "name": "xxxx",
         "no_discount": 0,
         "order_id": 10,
         "original_price": 128,
         "price": 128,
         "price_incl_tax": 140.8,
         "product_id": 2679,
         "product_type": "configurable",
         "qty_canceled": 0,
         "qty_invoiced": 0,
         "qty_ordered": 1,
         "qty_refunded": 0,
         "qty_shipped": 0,
         "quote_item_id": 27,
         "row_invoiced": 0,
         "row_total": 128,
         "row_total_incl_tax": 140.8,
         "row_weight": 4.079,
         "sku": "IV18",
         "store_id": 1,
         "tax_amount": 12.8,
         "tax_invoiced": 0,
         "tax_percent": 10,
         "updated_at": "2019-03-18 23:33:17",
         "weight": 4.079
      },
            {
         "amount_refunded": 0,
         "base_amount_refunded": 0,
         "base_discount_amount": 0,
         "base_discount_invoiced": 0,
         "base_price": 0,
         "base_row_invoiced": 0,
         "base_row_total": 0,
         "base_tax_amount": 0,
         "base_tax_invoiced": 0,
         "created_at": "2019-03-18 23:33:17",
         "discount_amount": 0,
         "discount_invoiced": 0,
         "discount_percent": 0,
         "free_shipping": 0,
         "is_qty_decimal": 0,
         "is_virtual": 0,
         "item_id": 28,
         "name": "xxxx",
         "no_discount": 0,
         "order_id": 10,
         "original_price": 0,
         "parent_item_id": 27,
         "price": 0,
         "product_id": 2400,
         "product_type": "simple",
         "qty_canceled": 0,
         "qty_invoiced": 0,
         "qty_ordered": 1,
         "qty_refunded": 0,
         "qty_shipped": 0,
         "quote_item_id": 28,
         "row_invoiced": 0,
         "row_total": 0,
         "row_weight": 0,
         "sku": "IV18",
         "store_id": 1,
         "tax_amount": 0,
         "tax_invoiced": 0,
         "tax_percent": 0,
         "updated_at": "2019-03-18 23:33:17",
         "weight": 4.079,
         "parent_item":          {
            "amount_refunded": 0,
            "base_amount_refunded": 0,
            "base_discount_amount": 0,
            "base_discount_invoiced": 0,
            "base_discount_tax_compensation_amount": 0,
            "base_original_price": 128,
            "base_price": 128,
            "base_price_incl_tax": 140.8,
            "base_row_invoiced": 0,
            "base_row_total": 128,
            "base_row_total_incl_tax": 140.8,
            "base_tax_amount": 12.8,
            "base_tax_invoiced": 0,
            "created_at": "2019-03-18 23:33:17",
            "discount_amount": 0,
            "discount_invoiced": 0,
            "discount_percent": 0,
            "free_shipping": 0,
            "discount_tax_compensation_amount": 0,
            "is_qty_decimal": 0,
            "is_virtual": 0,
            "item_id": 27,
            "name": "xxxx",
            "no_discount": 0,
            "order_id": 10,
            "original_price": 128,
            "price": 128,
            "price_incl_tax": 140.8,
            "product_id": 2679,
            "product_type": "configurable",
            "qty_canceled": 0,
            "qty_invoiced": 0,
            "qty_ordered": 1,
            "qty_refunded": 0,
            "qty_shipped": 0,
            "quote_item_id": 27,
            "row_invoiced": 0,
            "row_total": 128,
            "row_total_incl_tax": 140.8,
            "row_weight": 4.079,
            "sku": "IV18",
            "store_id": 1,
            "tax_amount": 12.8,
            "tax_invoiced": 0,
            "tax_percent": 10,
            "updated_at": "2019-03-18 23:33:17",
            "weight": 4.079
         }
      }
   ],
   "billing_address":    {
      "address_type": "billing",
      "city": "DANDENONG SOUTH",
      "country_id": "AU",
      "email": "xxx@xxx.com",
      "entity_id": 20,
      "firstname": "wwwwe",
      "lastname": "olwww",
      "parent_id": 10,
      "postcode": "1111",
      "region": "VIC",
      "region_code": "VIC",
      "street":       [
         "51",
         "Bazalgette crescent"
      ],
      "telephone": "0387666000"
   },
   "payment":    {
      "account_status": null,
      "additional_information": ["Check / Money order"],
      "amount_ordered": 145.8,
      "base_amount_ordered": 145.8,
      "base_shipping_amount": 5,
      "cc_exp_year": "0",
      "cc_last4": null,
      "cc_ss_start_month": "0",
      "cc_ss_start_year": "0",
      "entity_id": 10,
      "method": "checkmo",
      "parent_id": 10,
      "shipping_amount": 5
   },
   "status_histories": [   {
      "comment": "Success Imported ",
      "created_at": "2019-03-19 10:46:50",
      "entity_id": 1,
      "is_customer_notified": 0,
      "is_visible_on_front": 0,
      "parent_id": 10,
      "status": "pending"
   }],
   "extension_attributes": {"shipping_assignments": [   {
      "shipping":       {
         "address":          {
            "address_type": "shipping",
            "city": "DANDENONG SOUTH",
            "country_id": "AU",
            "email": "xxx@xxx.com",
            "entity_id": 19,
            "firstname": "wwwwe",
            "lastname": "olwww",
            "parent_id": 10,
            "postcode": "1111",
            "region": "VIC",
            "region_code": "VIC",
            "street":             [
               "51",
               "Bazalgette crescent"
            ],
            "telephone": "0387666000"
         },
         "method": "flatrate_flatrate",
         "total":          {
            "base_shipping_amount": 5,
            "base_shipping_discount_amount": 0,
            "base_shipping_discount_tax_compensation_amnt": 0,
            "base_shipping_incl_tax": 5,
            "base_shipping_tax_amount": 0,
            "shipping_amount": 5,
            "shipping_discount_amount": 0,
            "shipping_discount_tax_compensation_amount": 0,
            "shipping_incl_tax": 5,
            "shipping_tax_amount": 0
         }
      },
      "items":       [
                  {
            "amount_refunded": 0,
            "base_amount_refunded": 0,
            "base_discount_amount": 0,
            "base_discount_invoiced": 0,
            "base_discount_tax_compensation_amount": 0,
            "base_original_price": 128,
            "base_price": 128,
            "base_price_incl_tax": 140.8,
            "base_row_invoiced": 0,
            "base_row_total": 128,
            "base_row_total_incl_tax": 140.8,
            "base_tax_amount": 12.8,
            "base_tax_invoiced": 0,
            "created_at": "2019-03-18 23:33:17",
            "discount_amount": 0,
            "discount_invoiced": 0,
            "discount_percent": 0,
            "free_shipping": 0,
            "discount_tax_compensation_amount": 0,
            "is_qty_decimal": 0,
            "is_virtual": 0,
            "item_id": 27,
            "name": "xxxx",
            "no_discount": 0,
            "order_id": 10,
            "original_price": 128,
            "price": 128,
            "price_incl_tax": 140.8,
            "product_id": 2679,
            "product_type": "configurable",
            "qty_canceled": 0,
            "qty_invoiced": 0,
            "qty_ordered": 1,
            "qty_refunded": 0,
            "qty_shipped": 0,
            "quote_item_id": 27,
            "row_invoiced": 0,
            "row_total": 128,
            "row_total_incl_tax": 140.8,
            "row_weight": 4.079,
            "sku": "IV18",
            "store_id": 1,
            "tax_amount": 12.8,
            "tax_invoiced": 0,
            "tax_percent": 10,
            "updated_at": "2019-03-18 23:33:17",
            "weight": 4.079
         },
                  {
            "amount_refunded": 0,
            "base_amount_refunded": 0,
            "base_discount_amount": 0,
            "base_discount_invoiced": 0,
            "base_price": 0,
            "base_row_invoiced": 0,
            "base_row_total": 0,
            "base_tax_amount": 0,
            "base_tax_invoiced": 0,
            "created_at": "2019-03-18 23:33:17",
            "discount_amount": 0,
            "discount_invoiced": 0,
            "discount_percent": 0,
            "free_shipping": 0,
            "is_qty_decimal": 0,
            "is_virtual": 0,
            "item_id": 28,
            "name": "xxxx",
            "no_discount": 0,
            "order_id": 10,
            "original_price": 0,
            "parent_item_id": 27,
            "price": 0,
            "product_id": 2400,
            "product_type": "simple",
            "qty_canceled": 0,
            "qty_invoiced": 0,
            "qty_ordered": 1,
            "qty_refunded": 0,
            "qty_shipped": 0,
            "quote_item_id": 28,
            "row_invoiced": 0,
            "row_total": 0,
            "row_weight": 0,
            "sku": "IV18",
            "store_id": 1,
            "tax_amount": 0,
            "tax_invoiced": 0,
            "tax_percent": 0,
            "updated_at": "2019-03-18 23:33:17",
            "weight": 4.079,
            "parent_item":             {
               "amount_refunded": 0,
               "base_amount_refunded": 0,
               "base_discount_amount": 0,
               "base_discount_invoiced": 0,
               "base_discount_tax_compensation_amount": 0,
               "base_original_price": 128,
               "base_price": 128,
               "base_price_incl_tax": 140.8,
               "base_row_invoiced": 0,
               "base_row_total": 128,
               "base_row_total_incl_tax": 140.8,
               "base_tax_amount": 12.8,
               "base_tax_invoiced": 0,
               "created_at": "2019-03-18 23:33:17",
               "discount_amount": 0,
               "discount_invoiced": 0,
               "discount_percent": 0,
               "free_shipping": 0,
               "discount_tax_compensation_amount": 0,
               "is_qty_decimal": 0,
               "is_virtual": 0,
               "item_id": 27,
               "name": "xxxx",
               "no_discount": 0,
               "order_id": 10,
               "original_price": 128,
               "price": 128,
               "price_incl_tax": 140.8,
               "product_id": 2679,
               "product_type": "configurable",
               "qty_canceled": 0,
               "qty_invoiced": 0,
               "qty_ordered": 1,
               "qty_refunded": 0,
               "qty_shipped": 0,
               "quote_item_id": 27,
               "row_invoiced": 0,
               "row_total": 128,
               "row_total_incl_tax": 140.8,
               "row_weight": 4.079,
               "sku": "IV18",
               "store_id": 1,
               "tax_amount": 12.8,
               "tax_invoiced": 0,
               "tax_percent": 10,
               "updated_at": "2019-03-18 23:33:17",
               "weight": 4.079
            }
         }
      ]
   }]}
}
  • which endpoint do you use? – fmsthird Mar 27 at 4:12
  • @magefms /magento2/rest/all/V1/orders/3 – Yezzy Sarl Mar 28 at 0:30
  • what is 3? is that the item id? – fmsthird Mar 28 at 3:03
  • 3 is the order id – Yezzy Sarl Mar 28 at 8:55
  • is the result the one in your post? – fmsthird Mar 28 at 9:01

Your Answer

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

Browse other questions tagged or ask your own question.