How to Add Custom Fields to a Product Feed in Magento 2

Although Magento 2 Data Feed Generator supports all product attributes, sometimes you may need to change the display of a particular attribute or add additional fields to the feed.

All fields are recorded in the feed in the {} format, which we call tags. You can read more information about them in our Data Feed Generator Tags documentation.

Let’s add a Delivery Time field to a product feed.

Step 1. Add {product.delivery_time} tag to the feed

For XML feed, add the tag to the Template Editor -> Item Element field.


For CSV feed, add the name of the field to the Template Editor -> Header field, and the tag – to the Template Editor -> Item Element field.

Template Editor -> Header
Template Editor -> Item Element

Step 2. Create a file that will determine delivery_time for the product.

For this, you need to implement the \Plumrocket\Datagenerator\Model\Feed\Resolver\FieldResolverInterface interface.


namespace Vendor\Module\Model;

use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Store\Api\Data\StoreInterface;
use Plumrocket\Datagenerator\Model\Feed\Resolver\FieldResolverInterface;
use Plumrocket\Datagenerator\Model\Feed\TagInterface;

class DeliveryTimeResolver implements FieldResolverInterface
    public function resolve(
        TagInterface $tag,
        ProductInterface $product,
        StoreInterface $store,
        array $data,
        array $params = []
    ): string {
        return '2 working days';

Step 3. Register the resolver for the delivery_time tag in di.xml

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Plumrocket\Datagenerator\Model\Feed\Resolver\FieldComposite">
            <argument name="fieldResolvers" xsi:type="array">
                <item name="delivery_time" xsi:type="object">Vendor\Module\Model\DeliveryTimeResolver</item>

The Delivery Time field is now added to the product.

Was this article helpful?