REST API rest/all/V1/orders/create does not trigger "inventory_reservations_placement" plugin
- Dominant language
- PHP
- Stars
- 357
- Forks
- 262
- PR merge metrics
- No merged PRs in 30d
Description
REST API `rest/all/V1/orders/create` does not trigger `inventory_reservations_placement` plugin.
### Preconditions (*)
`Magento 2.3.3` with `sample` data
1. Create OAuth tokens with access to create order resource

2. End point: `https://INSTANCE/rest/all/V1/orders/create`
3. Method: `PUT`
4. Content-Type: application/json
5. JSON data to verify:
```
{
"entity": {
"base_currency_code": "USD",
"base_discount_amount": 0,
"base_discount_tax_compensation_amount": 0,
"base_grand_total": 53.71,
"base_shipping_amount": 5,
"base_shipping_discount_amount": null,
"base_shipping_incl_tax": null,
"base_shipping_tax_amount": null,
"base_subtotal": 45,
"base_subtotal_incl_tax": 48.71,
"base_tax_amount": 3.71,
"base_to_global_rate": 1,
"base_to_order_rate": 1,
"base_total_due": 53.71,
"base_total_paid": 0,
"billing_address": {
"address_type": "billing",
"city": "Calder",
"company": "",
"country_id": "US",
"customer_address_id": null,
"email": "roni_cost@example.com",
"entity_id": null,
"firstname": "Veronica",
"lastname": "Costello",
"parent_id": null,
"postcode": "49628-7978",
"region": "MI",
"region_code": null,
"street": [
"6146 Honey Bluff Parkway", ""
],
"telephone": "0000000000"
},
"billing_address_id": null,
"created_at": null,
"customer_email": "roni_cost@example.com",
"customer_firstname": "Veronica",
"customer_group_id": 1,
"customer_id": 1,
"customer_is_guest": 0,
"customer_lastname": "Costello",
"customer_note_notify": null,
"discount_amount": 0,
"discount_tax_compensation_amount": 0,
"email_sent": null,
"entity_id": null,
"extension_attributes": {
"applied_taxes": null,
"converting_from_quote": false,
"item_applied_taxes": null,
"shipping_assignments": [
{
"items": [
{
"additional_data": "",
"base_cost": 45,
"base_original_price": 45,
"base_price": 45,
"base_price_incl_tax": null,
"base_row_total": 45,
"base_row_total_incl_tax": 48.71,
"base_tax_amount": 3.71,
"created_at": null,
"item_id": null,
"name": "Push It Messenger Bag",
"order_id": null,
"original_price": 45,
"price": 45,
"price_incl_tax": 48.71,
"product_id": 14,
"product_type": "simple",
"qty_ordered": 1,
"row_total": 45.51,
"row_total_incl_tax": 48.71,
"sku": "24-MB06",
"store_id": 1,
"tax_amount": 3.71,
"updated_at": null
} ],
"shipping": {
"address": {
"address_type": "shipping",
"city": "Lynnwood,",
"company": "",
"country_id": "US",
"customer_address_id": null,
"email": "roni_cost@example.com",
"entity_id": null,
"firstname": "Veronica",
"lastname": "Costello",
"parent_id": null,
"postcode": "98087-6266",
"region": "WA",
"region_code": null,
"street": [
"13724 39th Pl W",
""
],
"telephone": "0000000000"
},
"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
} }
} ]
},
"global_currency_code": "USD",
"grand_total": 49.90,
"increment_id": null,
"items": [
{
"additional_data": "232",
"base_cost": 45,
"base_original_price": 45,
"base_price": 45,
"base_price_incl_tax": null,
"base_row_total": 45,
"base_row_total_incl_tax": 48.71,
"base_tax_amount": 3.71,
"created_at": null,
"item_id": null,
"name": "Push It Messenger Bag",
"order_id": null,
"original_price": 45,
"price": 45,
"price_incl_tax": null,
"product_id": 14,
"product_type": "simple",
"qty_ordered": 1,
"row_total": 45,
"row_total_incl_tax": 48.71,
"sku": "24-WB04",
"store_id": 1,
"tax_amount": 3.71,
"updated_at": null
} ],
"order_currency_code": "USD",
"payment": {
"account_status": null,
"additional_information": null,
"amount_ordered": 53.71,
"amount_paid": 0,
"base_amount_ordered": 53.71,
"base_amount_paid": 0,
"base_shipping_amount": 5.00,
"cc_last4": null,
"entity_id": null,
"method": "checkmo",
"parent_id": null,
"shipping_amount": 5.00
},
"protect_code": null,
"shipping_amount": 5.00,
"shipping_description": "Ground - 4-7 Business Days",
"shipping_discount_amount": null,
"shipping_discount_tax_compensation_amount": 0,
"shipping_incl_tax": 5.00,
"shipping_tax_amount": null,
"state": "new",
"status": "pending",
"status_histories": null,
"store_currency_code": "USD",
"store_id": 1,
"store_name": null,
"store_to_base_rate": 0,
"store_to_order_rate": 0,
"subtotal": 45.00,
"subtotal_incl_tax": 48.71,
"tax_amount": 3.71,
"total_due": null,
"total_item_count": 1,
"total_paid": null,
"total_qty_ordered": 1,
"updated_at": null
}
}
```

### Steps to reproduce (*)
1. Place order with product which has the enabled "Manage Stock" option. In this example, I've used - `24-WB04`
### Expected result (*)
1. Order is created via REST API call. Ordered item is reserved and exists in the `inventory_reservation` table

### Actual result (*)
1. Order is created but ordered item is not reserved and does not exist in the `inventory_reservation` table
Contributor guide
Research direction
Start by tracing the REST API entry point `rest/all/V1/orders/create` and the `inventory_reservations_placement` plugin, then compare this path with order creation paths that write to the `inventory_reservation` table. Done means an order created through this endpoint reserves its ordered item and creates the expected reservation record.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100