Magento V2 API override Product Info Model V2 (Attribute not showing)

Magento V2 API override Product Info Model V2 (Attribute not showing)

October 10, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento V2 API override Product Info Model V2 (Attribute not showing)

Solving Magento V2 API Override Issues: Product Info Model V2

Introduction

In this post, we will troubleshoot a common issue faced by many Magento developers when trying to override the catalogProductInfo model in version 2 of the Magento SOAP API. Specifically, we’ll address problems with adding custom attributes to the returning soap result.

If you’re facing challenges in getting your new attribute displayed after overriding the product info API, this guide will provide a step-by-step solution and best practices for achieving the desired outcome.

Understanding the Issue

The developer in question has already made significant progress in trying to resolve the issue. They have:

  • Attempted to disable SOAP cache settings in php.ini.
  • Deleted the WSDL cache file from the /tmp/ folder.
  • Disabled Magento caching and reindexed data.

Despite these efforts, the new attribute is still not showing up in the soap result after overriding the API model.

Analyzing the Current Approach

Let’s break down what the developer has done so far:

Module Creation and Configuration

The developer has created a custom module with a proper config.xml file that successfully rewrites the Mage_Catalog_Model_Product_Api_V2 class. This is evident from the ability to “break” the model within their module.

<config>
    <modules>
        <Namespace_ImportExport>
            <version>0.0.1</version>
        </Namespace_ImportExport>
    </modules>
    <global>
        <models>
            <catalog>
                <rewrite>
                    <product_api_v2>Namespace_ImportExport_Model_Product_Api_V2</product_api_v2>
                </rewrite>
            </catalog>
        </models>
    </global>
</config>

Model Override

The developer has overridden the info method of the Magento_Catalog_Model_Product_Api_V2 class in their custom module.

public function info($productId, $store = null, $attributes = null, $identifierType = null)
{
    // ... existing code ...

    $result = array( // Basic product data
        'associated' => "test",
        'product_id' => $product->getId(),
        // ... other attributes ...
    );

    return $result;
}

Adding the Custom Attribute to WSDL

The developer has even attempted to add the associated attribute to the catalogProductReturnEntity complex type in the module’s wsdl.xml file.

<complexType name="catalogProductReturnEntity">
    <all>
        <!-- ... existing attributes ... -->
        <element name="associated" type="xsd:string" minOccurs="0" />
        <!-- ... other attributes ... -->
    </all>
</complexType>

Identifying the Root Cause

The developer has implemented all the necessary steps to override the API model and add a custom attribute. The issue seems to be related to how Magento processes the WSDL cache.

Despite disabling SOAP caching in php.ini and deleting the cache file, it appears that Magento still uses an outdated version of the WSDL cache for some reason. This could be due to caching mechanisms used internally by Magento or by the web server itself.

The Solution: Refreshing the WSDL Cache

To resolve this issue, we need to ensure that Magento generates a fresh WSDL file and clears any cached versions.

Step 1: Clear Magento’s WSDL Cache

By default, Magento stores its WSDL cache under var/wsdl/. To clear this cache:

rm -rf var/wsdl/*

Step 2: Flush the Magento Cache

Even though caching is disabled in the admin panel and command line tools have been used, it’s important to flush any remaining cached data.

php bin/magento cache:flush

Step 3: Rebuild the WSDL

After clearing the cache, we need to force Magento to regenerate its WSDL files. This can be done by rebuilding the SOAP services:

php bin/magento soap:services:rebuild

This command will create new WSDL files for all enabled SOAP services.

Step 4: Restart the Web Server

To ensure that no outdated cache versions remain, it’s recommended to restart your web server after making these changes. This depends on the specific web server you’re using (Apache, Nginx, etc.).

Conclusion

In conclusion, the root cause of this issue is likely due to Magento’s internal caching mechanisms for WSDL files. To resolve it:

  1. Clear the var/wsdl/ directory.
  2. Flush all Magento cache.
  3. Rebuild the SOAP services using the command provided.
  4. Restart your web server.

After following these steps, your custom attribute should now be visible in the soap result after overriding the product info API model.

Remember to always test your changes thoroughly and monitor your site’s performance to ensure that the WSDL cache is being handled efficiently.

For more information on Magento development best practices and advanced techniques, visit Laravel Company.

Catalog Cache Indexing API

Our network