0

I am trying to create orders via REST API with the steps listed in the following link.

http://devdocs.magento.com/guides/v2.2/get-started/order-tutorial/order-intro.html

I want to change the price of the item when adding to the cart. But the price is not getting overridden and it always takes the default Product price.

Any possible help would be appreciated.

0

For me to do this i put all prices manually in the Json and it is working for me, Please see this JSON

{
  "entity": {
    "state": "new",
    "status": "pending",
    "base_discount_amount": "15.870000",
    "base_grand_total": 849.7,
    "base_shipping_amount": 10,
    "base_shipping_incl_tax": 10,
    "base_subtotal": 793.35,
    "base_subtotal_incl_tax": 855.55,
    "base_tax_amount": 62.2,
    "customer_email": "yourmail@mail.com",
    "customer_id": "1",
    "customer_is_guest": 0,
    "discount_amount": "15.870000",
    "ext_customer_id": 0,
    "grand_total": 849.7,
    "shipping_amount": "10.000000",
    "shipping_description": "Shipping Method",
    "shipping_incl_tax": 10,
    "store_id": 1,
    "subtotal": 793.35,
    "subtotal_incl_tax": 855.55,
    "tax_amount": 62.2,
    "total_item_count": 2,
    "total_qty_ordered": 6,
    "items": [
      {
        "discount_percent": "2.000000",
        "name": "ProductName1",
        "original_price": "135.300000",
        "price": "135.300000",
        "price_incl_tax": "146.120000",
        "product_id": "45",
        "qty_ordered": "5.000000",
        "row_total": "676.500000",
        "sku": "A00005",
        "store_id": 1,
        "tax_amount": "53.040000",
        "tax_percent": "8.000000",
        "product_option": {}
      },
      {
        "discount_percent": "2.000000",
        "name": "ProductName2",
        "original_price": "116.850000",
        "price": "116.850000",
        "price_incl_tax": "126.200000",
        "product_id": "26",
        "qty_ordered": "1.000000",
        "row_total": "116.850000",
        "sku": "A00005",
        "store_id": 1,
        "tax_amount": "9.160000",
        "tax_percent": "8.000000",
        "product_option": {}
      }
    ],
    "billing_address": {
      "city": "city",
      "country_id": "",
      "customer_id": 1,
      "email": "yourmail@mail.com",
      "firstname": "firstname",
      "lastname": "lastname",
      "postcode": "33332",
      "region": "",
      "region_id": "28",
      "street": [
        "Address"
      ],
      "telephone": "123456"
    },
    "payment": {
      "amount_ordered": 0,
      "base_amount_ordered": 0,
      "base_shipping_amount": 0,
      "entity_id": 0,
      "method": "checkmo",
      "shipping_amount": 0
    },
    "extension_attributes": {
      "shipping_assignments": [
        {
          "shipping": {
            "address": {
              "city": "city",
              "country_id": "US",
              "customer_id": 1,
              "firstname": "firstname",
              "lastname": "lastname",
              "postcode": "33332",
              "region": "",
              "region_id": "28",
              "street": [
                "Address"
              ],
              "telephone": "123456"
            },
            "method": "flatrate_flatrate",
            "total": {
              "base_shipping_amount": 0,
              "base_shipping_incl_tax": 0,
              "shipping_incl_tax": 0
            }
          }
        }
      ]
    }
  }
}

don't forget to change the

  • customer_id

  • email

  • Product name

  • Product SKU -Product ID

    it is very important

  • This request JSON is for the endpoint http://{hostname}/rest/default/V1/orders - POST. This works good for me too. But inventory for the items is not getting reduced. Did you face this issue? If so, please suggest the solution. – Keerthipriyan Rengasamy Apr 14 '18 at 15:57

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.