Extend and customize SaaS data export feed data

The Commerce Data Export extension provides a way to export data from the Commerce application to Commerce Services like Live Search, Catalog Service, and Product Recommendations. If needed, you can extend and customize the feed data to include additional attribute data or modify the collected data.

After adding attribute data, it is accessible from the attributes field in the GraphQL schema for storefront services.

NOTE
Adding or modifying feed data can impact performance and processing logic on the Commerce backend. Test customized code before merging to production. Instead of adding data to the backend, use API Mesh to extend the Catalog Service GraphQL schema. For configuration details, see Catalog Service and API Mesh.

Extend system attributes data in the products feed

The products feed includes default system attributes which are required for product processing or commonly used by consumers. You can include additional system attributes in the products feed by adding them to the feed.

To complete this task, update the magento/catalog-data-exporter module to add the additional system attributes to the dependency injection configuration file (di.xml).

Add the attributes to the Product Attribute query(Magento\CatalogDataExporter\Model\Query\ProductAttributeQuery).

Example

    <type name="Magento\CatalogDataExporter\Model\Query\ProductAttributeQuery">
        <arguments>
            <argument name="systemAttributes" xsi:type="array">
                <item name="news_from_date" xsi:type="string">news_from_date</item>
                ...
                <item name="some_system_attribute_code">some_system_attribute_code</item>
            </argument>
        </arguments>
    </type>

Add product attributes to Adobe Commerce

Developers can add product attributes that are accessible from the product attributes field by using one of the following methods:

  • Add the attribute to Adobe Commerce for inclusion in the products feed data exported to Commerce storefront services.
  • Add the attribute dynamically during the feed synchronization process using a plugin.

Add the attribute to Adobe Commerce

You can add a product attribute from the Commerce Admin, or programmatically using a custom PHP module to define the attribute and update Adobe Commerce. Adding the attribute from the Commerce Admin is the simplest method because you can add the attribute and all the required metadata at once. The new attribute and its metadata properties are exported to the SaaS services automatically during the next scheduled synchronization.

Create the product attribute from the Admin

  1. From the Commerce Admin, create the attribute from the product attribute configuration page (Stores > Attributes > Product).

  2. Add the attribute to an attribute set as needed.

See Create product attributes in the Adobe Commerce Admin Guide.

Create the product attribute programmatically

Add a product attribute programmatically by creating a data patch that implements the DataPatchInterface, and instantiate a copy of the EavSetup Factory class within the constructor to configure the attribute options.

When you define the attribute options, all attribute parameters except type, label, and input are optional. Define the following additional parameters and any others that differ from the default settings.

  • user_defined = 1—Export the attribute to storefront services during data synchronization
  • used_in_product_listing = 1—Make the attribute accessible within the product listing database query

For information about creating data patches, see Develop data and schema patches in the PHP Developer Guide.

Add the product attribute dynamically

For details about creating product attributes dynamically without introducing new EAV Attributes, see Add product attributes dynamically.

Feed schema overview (et_schema.xml) feed-schema-overview

Each feed data structure is declared in etc/et_schema.xml using a simple XML DSL. The framework reads this file to determine which fields to collect and which PHP provider classes to call.

<record name="Product">
  <field name="sku" type="ID" />
  <field name="name" type="String" />
  <field name="attributes" type="Attribute" repeated="true"
         provider="Magento\CatalogDataExporter\Model\Provider\Product\Attributes">
    <using field="productId" />
    <using field="storeViewCode" />
  </field>
</record>

Key elements:

  • <record> - defines the feed entity
  • <field> - declares a data field; the provider attribute points to a PHP class implementing DataProcessorInterface that fetches the data
  • repeated="true" - the field is an array of objects
  • <using> - input parameters passed from the parent record context to the provider
IMPORTANT
Adding a new field to et_schema.xml only changes what Adobe Commerce collects locally. The receiving SaaS service must also be updated to accept and process the new field before it has any effect on the storefront.

Observe data after submission observe-data-after-submission

SaaS Data Export dispatches the data_sent_outside event after each successful batch submission to a SaaS service. Use this event for audit logging, webhook triggers, or metrics collection.

Event: data_sent_outside

Available data:

Key
Description
timestamp
Unix timestamp of the submission
type
Feed name (for example, products, prices)
data
The submitted feed payload

Example observer:

<?php
namespace My\Module\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class DataSentOutsideObserver implements ObserverInterface
{
    public function execute(Observer $observer): void
    {
        $feedName = $observer->getData('type');
        $timestamp = $observer->getData('timestamp');
        $data = $observer->getData('data');

        // Custom logic: audit logging, webhook, metrics
    }
}

Register the observer in etc/events.xml:

<event name="data_sent_outside">
    <observer name="my_module_data_sent_outside"
              instance="My\Module\Observer\DataSentOutsideObserver" />
</event>

For general information about events and observers, see Events and Observers in the Adobe Commerce Developer documentation.

Filter data before submission

Use the Magento\SaaSCommon\Model\DataFilter extension point to redact sensitive fields or skip specific entities before data is sent to the SaaS service. This is useful for compliance requirements such as GDPR or PCI where certain fields must not leave the Commerce instance.

Implement the interface and wire it via a DI preference in etc/di.xml:

<preference for="Magento\SaaSCommon\Model\DataFilter"
            type="My\Module\Model\MyDataFilter" />
NOTE
Filtering is applied after data collection. If PERSIST_EXPORTED_FEED=1 is set, the feed table stores the unfiltered payload before filtering occurs.
recommendation-more-help
commerce-help-data-export