PUT /V1/products/{productSku}/stockItems/{itemId}
Hello @dtanh91gmafa0f
Step 1: Authenticate
POST /rest/V1/integration/admin/token
Content-Type: application/json
{
"username": "admin",
"password": "admin123"
}Step 2: Update Stock: To update the stock of a product, you'll use the /rest/V1/products/{sku} endpoint.
PUT /rest/V1/products/{sku}
Authorization: Bearer {access_token}
Content-Type: application/json
{
"product": {
"sku": "{sku}",
"name": "Product Name Here",
"price": 99,
"status": 1,
"type_id": "simple",
"attribute_set_id": 4,
"custom_attributes": [
{
"attribute_code": "quantity_and_stock_status",
"value": "1"
},
{
"attribute_code": "stock_status",
"value": "1"
},
{
"attribute_code": "stock",
"value": {
"qty": 110,
"is_in_stock": true
}
}
]
}
}Hope it helps !
If you find our reply helpful, please give us kudos.
A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.
WebDesk Solution Support Team
Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Thank You,
WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Location: 150 King St. W. Toronto, ON M5H 1J9