Magento API - Update Product and "Use Default Value" checkboxes

Magento API - Update Product and "Use Default Value" checkboxes

October 1, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento API - Update Product and "Use Default Value" checkboxes

Mastering Magento API for Product Updates: Ensuring Persistent “Use Default Value” Checkboxes

When working with the Magento API to update products, ensuring that key attributes like “Use Default Value” remain checked can be a challenge, especially when dealing with multiple store views. In this post, we’ll explore why the default behavior might not persist after an API update and provide a step-by-step solution to maintain the desired state.

The Challenge: The Default Behavior

Currently, Magento 2 treats the “Use Default Value” checkbox as a local attribute for each store view. When you make an API call to update a product’s attributes—such as setting stock quantity or availability—the platform resets this flag to unchecked by default, regardless of the previous configuration.

Why This Happens

This behavior is likely due to Magento’s architecture and how it handles attribute scope during API updates. The API layer doesn’t inherently preserve the state of flags like “Use Default Value” when applying changes from an external source.

The Solution: A Persistent Approach

To maintain the “Use Default Value” checkbox as checked across store views after an API update, we need to make a slight adjustment to our approach:

  1. Fetch the current product data: Before making any changes, fetch the complete product data using the /V1/products/<product_id> endpoint.

  2. Update only necessary fields: In your payload, include only the fields you want to modify (e.g., stock attributes). Do not send a full product object.

  3. Retain the original scope: Since we fetched the entire product before updating, Magento will preserve the original scope settings for unmentioned fields—including “Use Default Value”.

Here’s an example of how this looks in practice:

// Original fetch request
GET https://your_magento_instance.com/rest/V1/products/9854112

// Response (example)
{
  "id": 9854112,
  "sku": "9854112",
  "name": "Test Product",
  "extension_attributes": {
    "stockItem": {
      "is_in_stock": true,
      "qty": 10
    }
  },
  // ... (other attributes)
}

// Update request payload
{
  "product": {
    "extensionAttributes": {
      "stockItem": {
        "isInStock": false,
        "qty": 0
      }
    },
    "sku": "9854112"
  },
  "saveOptions": true
}

Notice that we’re sending only the necessary stock attributes in the update request. By doing so, Magento preserves the original scope settings (including “Use Default Value”) for all other fields.

Conclusion

Maintaining the “Use Default Value” checkbox across store views after a Magento API update requires a strategic approach to avoid resetting the scope of attributes during the update process. By fetching the complete product data beforehand and updating only the necessary fields, we can ensure that key settings like this are preserved even when making changes via the API.

Remember, this method relies on the original fetch request containing all relevant attributes—including those with “Use Default Value” checked. If new attributes are added after the initial fetch, they may not be included in the response and thus won’t be retained during subsequent updates.

For a more detailed guide on Magento API best practices and advanced configuration options, consider exploring our comprehensive Magento API documentation for in-depth insights tailored to your specific use case.

Magento 2 Catalog API Themes

Our network