0

I am using the API /rest/V1/orders/create, but when creating an order, the saleable quantity does not decrease. (Magento ver. 2.4.6-p3 community edition) I am using this payload:

    {
    "entity": {
        "customer_group_id": 1,
        "applied_rule_ids": "2",
        "base_currency_code": "EUR",
        "base_discount_amount": 0,
        "base_grand_total": 96,
        "base_shipping_amount": 5.575,
        "base_shipping_incl_tax": 5.575,
        "base_shipping_tax_amount": 0,
        "base_shipping_discount_amount": 0,
        "base_subtotal": 86,
        "base_subtotal_incl_tax": 86,
        "base_total_due": 0,
        "base_total_paid": 91.15,
        "base_to_global_rate": 1,
        "base_to_order_rate": 1,
        "discount_tax_compensation_amount": 0,
        "base_discount_tax_compensation_amount": 0,
        "shipping_discount_tax_compensation_amount": 0,
        "customer_is_guest": 0,
        "customer_email": "[email protected]",
        "customer_firstname": "Danilo",
        "customer_lastname": "Duarte",
        "customer_note_notify": 1,
        "discount_amount": 0,
        "email_sent": 1,
        "global_currency_code": "EUR",
        "grand_total": 96,
        "order_currency_code": "EUR",
        "shipping_amount": 5.575,
        "shipping_tax_amount": 0,
        "shipping_description": "checkmo",
        "shipping_discount_amount": 0,
        "shipping_incl_tax": 5.575,
        "state": "new",
        "status": "pending",
        "store_currency_code": "EUR",
        "store_to_base_rate": 0,
        "store_to_order_rate": 0,
        "store_id": 1,
        "subtotal": 86,
        "subtotal_incl_tax": 86,
        "total_due": 0,
        "total_paid": 91.15,
        "total_item_count": 2,
        "total_qty_ordered": 2,
        "tax_amount": 0,
        "weight": 0,
        "items": [
            {
                "base_original_price": 43,
                "base_price": 43,
                "base_price_incl_tax": 43,
                "base_row_total": 86,
                "base_row_total_incl_tax": 86,
                "name": "Luma Analog Watch",
                "original_price": 43,
                "price": 43,
                "price_incl_tax": 43,
                "product_id": 41,
                "product_type": "simple",
                "qty_ordered": 2,
                "row_total": 86,
                "row_total_incl_tax": 86,
                "sku": "24-WG09",
                "store_id": 1,
                "weight": 0
            }
        ],
        "billing_address": {
            "address_type": "billing",
            "city": "Barueri",
            "company": "",
            "country_id": "BR",
            "customer_address_id": 4,
            "email": "[email protected]",
            "firstname": "Danilo",
            "lastname": "Duarte",
            "postcode": "06414070",
            "region": "SP",
            "street": [
                "Rua Sol"
            ],
            "telephone": "11950807198"
        },
        "payment": {
            "additional_information": [
                "Check / Money order"
            ],
            "amount_ordered": 96,
            "amount_paid": 91.15,
            "base_amount_ordered": 96,
            "base_amount_paid": 91.15,
            "base_shipping_amount": 5.575,
            "method": "checkmo",
            "cc_exp_year": "0",
            "cc_ss_start_month": "0",
            "cc_ss_start_year": "0",
            "shipping_amount": 5.575
        },
        "status_histories": [
            {
                "comment": "Order Placed by Admin Username using Admin Panel",
                "created_at": "2024-03-15 16:54:05",
                "entity_id": 11,
                "entity_name": "order",
                "is_customer_notified": 0,
                "is_visible_on_front": 0,
                "parent_id": 75,
                "status": "pending"
            },
            {
                "comment": "Order Placed by Store Administrator",
                "created_at": "2024-03-15 16:54:05",
                "entity_id": 10,
                "entity_name": "order",
                "is_customer_notified": 0,
                "is_visible_on_front": 1,
                "parent_id": 75,
                "status": "pending"
            }
        ],
        "extension_attributes": {
            "payment_additional_info": [
                {
                    "key": "method_title",
                    "value": "Check / Money order"
                }
            ],
            "shipping_assignments": [
                {
                    "shipping": {
                        "address": {
                            "address_type": "shipping",
                            "city": "Barueri",
                            "company": "",
                            "country_id": "BR",
                            "customer_address_id": 4,
                            "email": "[email protected]",
                            "firstname": "Danilo",
                            "lastname": "Duarte",
                            "postcode": "06414070",
                            "region": "SP",
                            "street": [
                                "Rua Sol"
                            ],
                            "telephone": "11950807198"
                        },
                        "method": "flatrate_flatrate",
                        "total": {
                            "base_shipping_amount": 5.575,
                            "base_shipping_incl_tax": 5.575,
                            "shipping_amount": 5.575,
                            "shipping_incl_tax": 5.575
                        }
                    },
                    "items": [
                        {
                            "base_original_price": 43,
                            "base_price": 43,
                            "base_price_incl_tax": 43,
                            "base_row_total": 86,
                            "name": "Luma Analog Watch",
                            "original_price": 43,
                            "price": 43,
                            "price_incl_tax": 43,
                            "product_id": 41,
                            "product_type": "simple",
                            "qty_ordered": 2,
                            "row_total": 86,
                            "row_total_incl_tax": 86,
                            "sku": "24-WG09",
                            "store_id": 1,
                            "weight": 0
                        }
                    ],
                    "extension_attributes": [],
                    "stock_id": 1
                }
            ],
            "applied_taxes": [],
            "item_applied_taxes": [],
            "converting_from_quote": false
        }
    }
}

Please let me know what's missing here.

1 Answer 1

0

After creating an order, a reservation of this product is made. This is MSI functionality. Read more at https://developer.adobe.com/commerce/webapi/rest/inventory/. Only when the order is (paid and) shipped, the salable quantity will be lowered.

2
  • Exactly this reservation isn't happening when calling the API, this is in a testing environment, is there any configuration I need to make for the reservation to occur via API? When I create the order through the interface, reservation happens without any issues. Commented Mar 19 at 21:06
  • Do you have any extensions installed? There should be no difference between a regular order and an order through the API. I would suggest to disable all extensions and then try again.
    – JKıngma
    Commented Mar 22 at 14:13

Your Answer

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

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