run_as_root / ext-magento2-google-shopping-feed

run_as_root/ext-magento2-google-shopping-feed

This module provides a google shopping product feed csv export.

magento2-module Compatibility: 2.4.7-2.4.9 Code Quality: Fail Tests: Fail Security: Pass MIT

Are you the maintainer of run_as_root?

Packagento pulls run_as_root's Composer packages from the public registry so buyers can find them here.

Claim the namespace to take ownership, publish new releases directly, and start charging for premium versions.

Claim this namespace →

build

General

Generate feed with product data.

Installations

composer require run_as_root/ext-magento2-google-shopping-feed
bin/magento setup:upgrade

Inventory System Compatibility

This module automatically detects and supports both inventory systems:

  • Multi Source Inventory (MSI): If MSI modules are installed, the module will use the MSI system for stock management
  • Legacy Catalog Inventory: If MSI is not available, the module automatically falls back to the legacy catalog inventory system

MSI Support (Optional):
If you want to use MSI features, install the MSI modules:

composer require magento/module-inventory-sales magento/module-inventory-sales-api

The module will automatically detect MSI availability and use the appropriate inventory system without any configuration changes.

Features

Feed generation

Generate product feed every 2 hours with minimal required attributes, for each storeview.
Places file into pub/media/run_as_root/feed/%s_store_%s_feed.xml.

Prices

  • g:price is the regular price (price attribute) of the product.
  • g:sale_price is the final price a guest pays for one item (special price, tier price for quantity 1 and catalog price rules for the NOT LOGGED IN customer group and the store's website). It is only exported when it is still lower than the regular price after currency conversion and rounding.
  • Both use the price as entered in the catalog (no tax adjustments) and are converted once from the base currency into the store view currency.
  • Configurable products exported as parents use the prices of their cheapest enabled and salable child (on equal final prices, the one with the lower regular price). If no child is salable, all enabled children are considered. Grouped and bundle products are exported as their child products, each with its own prices.
  • g:sale_price_effective_date is not exported, so Google applies the sale price immediately. The feed is regenerated on every run, so ended sales disappear with the next run.

Configurable Product Export Control

Configure how configurable products are exported to the feed:

  • Only Parent Products: Export the configurable product itself with aggregated data from available children (lowest price, stock status based on child availability, parent product images)
  • Child Products (Variants): Export every enabled child product as a variant, regardless of its visibility. The link points to the parent product and item_group_id is the parent SKU

Technical Specification

Commands

group command description
run_as_root run_as_root:product-feed:execute Runs feed generation for all store views.

Crons

group cronjob description
default run_as_root_product_feed_exporter_cron Runs feed generation based on run_as_root_product_feed/general/cron_schedule config - default each 15 minutes

Entities

Attribute config

DTO: \RunAsRoot\GoogleShoppingFeed\Data\AttributeConfigData

Incapsulates the next information:

  • attribute name/code
  • handler class

List of attributes configurations can be found here: \RunAsRoot\GoogleShoppingFeed\Enum\AttributesToImportEnumInterface::ATTRIBUTES

Data providers

\RunAsRoot\GoogleShoppingFeed\DataProvider\AttributesConfigListProvider

Provides the list of DTOs ( AttributeConfigData ).
Used for CSV row data mapping from product - provides information regarding attributes that should be taken from the product and in wich way (handler).
See configuration list here: \RunAsRoot\GoogleShoppingFeed\Enum\AttributesToImportEnumInterface::ATTRIBUTES

\RunAsRoot\GoogleShoppingFeed\DataProvider\AttributeHandlerProvider

Provides attribute data provider (handler) of type \RunAsRoot\GoogleShoppingFeed\DataProvider\AttributeHandlers\AttributeHandlerInterface, by AttributeConfigData DTO.

\RunAsRoot\GoogleShoppingFeed\DataProvider\AttributeHandlers\AttributeHandlerInterface

Generic interface for attribute data providers.
Each attribute has its own data provider, that incapsulates current interface.
Data provider for specific attribute is configured here \RunAsRoot\GoogleShoppingFeed\Enum\AttributesToImportEnumInterface::ATTRIBUTES.

Services

\RunAsRoot\GoogleShoppingFeed\Service\GenerateFeedService

Perform feed generation for all storeviews with enabled feed generation.
\RunAsRoot\GoogleShoppingFeed\Service\GenerateFeedService is injected.

\RunAsRoot\GoogleShoppingFeed\Service\GenerateFeedService

Generate feed for specific store, based on feed enable*disable configuration.
Incapsulates attributes config provider \RunAsRoot\GoogleShoppingFeed\DataProvider\AttributesConfigListProvider and csv row mapper \RunAsRoot\GoogleShoppingFeed\Mapper\ProductToFeedAttributesRowMapper.
Performs iteration on all products provided by this collection provider \RunAsRoot\GoogleShoppingFeed\CollectionProvider\SimpleProductsCollectionProvider and adds rows into the CSV file.

Configuration

tab group section field
run_as_root general Product Feed Exporter Enable
run_as_root general Product Feed Exporter Cron Schedule
run_as_root general Product Feed Exporter Category Whitelist
run_as_root general Product Feed Exporter Category Blacklist
run_as_root general Product Feed Exporter Configurables Export

Configurables Export Options

The "Configurables Export" setting controls how configurable products are handled in the feed:

  • Child Products (Variants) (default): Exports every enabled child product of a configurable product as a variant, regardless of the child's visibility. The link points to the parent product and item_group_id is the parent SKU
  • Only Parent Products: Exports the configurable product itself, never its children, with aggregated data:
    • Price / Sale Price: Regular and final price of the enabled and salable child with the lowest final price
    • Stock Status: In-stock if at least one child is available
    • Images: Uses the configurable product's base image
    • Skips configurable products with no available children

This setting is configurable per store view to allow different export strategies for different stores.

A configurable product is an exportable parent in a store view when it is enabled, visible individually (Catalog, Search, or Catalog + Search) and assigned to the store view's website.

  • Children (simple or virtual) of an exportable parent are exported only through that parent, according to the setting above. They are not exported when the parent itself is not in the feed, for example when it is not assigned to an exported category. The link, item_group_id and fallback image come from the parent the child is exported with.
  • Children of configurable products that are not exportable parents are treated like any other product.
  • All other products, including children of grouped and bundle products, are exported only when they are visible individually, because products that are "Not Visible Individually" have no product page to link to. They are linked to their own product page.
  • Children of grouped and bundle products that are also children of an exportable parent get that configurable product's link and item_group_id.

Status and visibility are read from the store view value, falling back to the default (All Store Views) value.

Shipping

The shipping attribute is exported from the Magento table rate carrier (Stores > Configuration > Sales > Delivery Methods > Table Rates):

  • Nothing is exported when the table rate carrier is disabled, and nothing for virtual and downloadable products.
  • Each product gets the rate that checkout charges for a cart holding only that product: the table rate row with the highest condition value up to the product's price in a one-item guest cart (package_value, package_value_with_discount: special price, tier price for a quantity of 1 and catalog price rules of the NOT LOGGED IN group), weight (package_weight) or a quantity of 1 (package_qty), plus the configured handling fee. Only rows of the store's website are used. Configurable products use the weight of their heaviest enabled child and the price of their cheapest enabled child.
  • Rates are exported for the allowed countries of the store, limited to the carrier's "Ship to Specific Countries" when that is set.
  • One <g:shipping> is exported per country, plus one with <g:region> per region that has its own rate. Regions are exported only for countries whose Magento region codes are ISO 3166-2 codes (AU, BE, BR, CA, CH, MX, RO, US); region rows of other countries are not exported separately; instead the country gets the highest of its own rate and those region rates, so no region is under-quoted. A country without its own matching rate is not exported. Rows for specific ZIP codes are skipped. Rows for all countries (*) apply to every country, with lower priority than country rows, as in checkout.
  • Google accepts at most 100 <g:shipping> entries per product. When a product would get more, all rates that come from * rows are left out (rates from country rows are kept, cut at 100 if they alone exceed it) and a warning is logged once per store. Add table rate rows for your main countries, or set up shipping in the Merchant Center account, to avoid this.
  • This is a single-item cart estimate and Google uses it instead of the account shipping settings. If shipping depends on the cart total or weight of multi-item orders, consider leaving the shipping attribute out and setting up order-price or weight-based rates in the Merchant Center account shipping settings instead.

Known limitations:

  • package_value conditions are matched against the product's price excluding cart price rules. With tax-inclusive catalog prices, checkout compares the tax-excluded subtotal instead, so a product close to a tier boundary can get a different tier.
  • Cart price rules (free shipping, free method weight, discounts) are not applied: the feed shows the table rate without them, which may over-quote.
  • When the winning rate of a region has a negative price (checkout then offers no table rate there), the region is skipped, so Google applies the country rate to that region.

Extensability points

Add new attribute to feed

  1. Create new attribute data provider. @see interface \RunAsRoot\GoogleShoppingFeed\DataProvider\AttributeHandlers\AttributeHandlerInterface.
  2. Add configuration for new attribute in \RunAsRoot\GoogleShoppingFeed\Enum\AttributesToImportEnumInterface::ATTRIBUTES.

Use a custom shipping data source

The shipping attribute only reads the shipping_tablerate table. To feed shipping costs from another source (Colissimo, GLS, ...), add a DI <preference> for \RunAsRoot\GoogleShoppingFeed\DataProvider\AttributeHandlers\ShippingProvider pointing to your own class implementing AttributeHandlerInterface. Its get(Product $product) must return a list of ['country' => 'DE', 'price' => '12.00 EUR'] entries, optionally with a 'region' => 'BY' key (ISO 3166-2 subdivision code without the country prefix), which is exported as <g:region>.

Google Shopping Feeds Grid

Generated feeds could be reviewed inside Admin Backoffice

  • Navigate to Marketing -> run_as_root -> Google Shopping Feed

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.

[Unreleased]

[1.8.1] - 2026-11-30

Fixed

  • composer.json and etc/module.xml now declare all Magento modules the module uses: magento/module-backend, magento/module-bundle, magento/module-config, magento/module-cron and magento/module-ui are required, and Magento_Backend, Magento_Bundle, Magento_CatalogInventory, Magento_Config, Magento_Cron, Magento_GroupedProduct and Magento_Ui are added to the module sequence (#9)

[1.8.0] - 2026-11-25

Added

  • g:sale_price is exported when the final price (special price, catalog price rules for the NOT LOGGED IN customer group) is lower than the regular price (#36)

Fixed

  • Shipping: each product gets the single table rate that checkout would charge for it, per country and per region (<g:region>), instead of every shipping_tablerate row. Rows of other websites and ZIP-specific rows are skipped, and the carrier's "Ship to Specific Countries" setting is applied (#35)
  • Shipping: no <g:shipping> is exported when the table rate carrier is disabled, or for virtual and downloadable products (#35)
  • Shipping: when a product would exceed Google's limit of 100 shipping entries, the rates from table rate rows for all countries are left out (#35)
  • Products that are "Not Visible Individually" and are not children of a configurable product are no longer exported with a link to a page that does not exist (#3, #34)
  • Configurable products whose children are not assigned to an exported category no longer lose all their variants in "Child Products (Variants)" mode (#34)
  • Children of disabled or not visible configurable products are no longer linked to that parent's product page (#3, #34)
  • Virtual children of configurable products are linked to their parent like simple children, and children are limited to the store view's website (#34)
  • g:price contains the regular price instead of the discounted final price, so Google can show the sale (#36)
  • Catalog price rules were ignored when the feed was generated from the CLI command or cron (#36)
  • Configurable parent products take their price from their cheapest salable child instead of the storefront price renderer, which could add display tax adjustments and convert a non-base currency twice (#36)

Changed

  • Children of configurable products are exported only through their parent, according to the "Configurables Export" setting (#34):
    • "Child Products (Variants)" (default, previously labelled "Only Visible Child Products") exports every enabled child regardless of its visibility, linked to the parent and grouped by the parent SKU
    • "Only Parent Products" exports only the configurable product, no longer its children
  • A configurable product counts as a parent only when it is enabled, visible individually and assigned to the store view's website. Children of other configurable products are exported as standalone products when they are visible individually (#34)
  • Children of a configurable product are loaded with one collection query per parent instead of one product load per child (#34)
  • The module now depends on Magento_Customer (#35)
  • Constructor changes, relevant only to classes that extend these classes:
    • ShippingProvider: new TableRateCarrierConfigProvider, MatchingTableRatesProvider, StoreManagerInterface, LoggerInterface, SingleItemGuestCartPriceProvider (#35)
    • PriceProvider: new required ProductPricesProvider (#36)
    • ProductsCollectionProvider and ParentProductIdProvider: new ExportableConfigurableParentsCollectionProvider (#34)
    • GenerateFeedForStore: new ConfigurableChildrenCollectionProvider (#34)
  • ParentProductIdProvider::get() accepts an optional store ID and then returns the lowest ID among the child's exportable parents in that store (#34)

Deprecated

  • The unused RunAsRoot\GoogleShoppingFeed\DataProvider\AttributeHandlers\SpecialPriceProvider virtual type; use SalePriceProvider (#36)

[1.7.0] - 2026-11-17

Added

  • "Configurables Export" system configuration option (per store view) to export configurable parent products or their child products, optionally only visible children (#3)
  • Documentation for custom shipping data sources (#18)

Fixed

  • Fatal error when MSI is disabled; the module no longer depends on MSI (#10)
  • Media gallery data is added after the store filter and pagination (#17)
  • The no_selection product image is treated as missing (#19)
  • Wrong ACL resource in system.xml (#20)
  • Duplicate items in the feed caused by array_merge discarding product ID keys (#29)
  • Prices are formatted as 34.00 USD independent of the store locale (#30)
  • PHP 8.4 deprecation: explicit nullable type for the command name constructor parameter (#21)

Changed

  • PHPUnit 10 compatibility and PHPStan fixes

[1.6.0] - 2025-06-03

Fixed

  • Missing required argument $directory: FilesystemIterator argument path replaced with directory (#1)

[1.5.0] - 2023-06-13

Added

  • GitHub Actions pipeline running code style checks and unit tests (#5)

[1.4.0] - 2022-09-22

Added

  • Admin grid listing recently generated feeds (Marketing -> run_as_root -> Google Shopping Feeds)

[1.3.0] - 2022-09-21

Changed

  • Default cron execution time
  • Added product type attribute handler
Versions
Version Stability QA Status Compatibility Released
1.8.1 stable Fail Magento 2.4.7-2.4.9 Details 2026-11-30 08:55:57
1.8.0 stable Fail Magento 2.4.7-2.4.9 Details 2026-11-25 09:24:47
1.7.0 stable Fail Magento 2.4.7-2.4.9 Details 2026-11-17 12:36:49
1.6.0 stable Fail Not yet tested Details 2025-06-03 16:33:37
1.5.0 stable Not tested Not yet tested Details 2023-06-13 20:25:57
1.4.0 stable Not tested Not yet tested Details 2022-09-22 10:52:43
1.3.0 stable Not tested Not yet tested Details 2022-09-21 08:34:22

Requires 17

Package Constraint
magento/framework *
magento/module-backend *
magento/module-bundle *
magento/module-catalog *
magento/module-catalog-inventory *
magento/module-config *
magento/module-configurable-product *
magento/module-cron *
magento/module-customer *
magento/module-directory *
magento/module-eav *
magento/module-grouped-product ^100.4
magento/module-import-export *
magento/module-review *
magento/module-store *
magento/module-ui *
psr/log *

Requires-dev 5

Package Constraint
magento/magento-coding-standard ^31.0
pdepend/pdepend ^2.14
phpunit/phpunit ^10.0
slevomat/coding-standard ^8.12
squizlabs/php_codesniffer ^3.7

Suggests 2

Package Reason
magento/module-inventory-sales For Multi Source Inventory (MSI) support. If not installed, the module will fallback to legacy catalog inventory.
magento/module-inventory-sales-api Required when using MSI inventory system for stock management.

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Pass
2.4.9 Pass Pass

Code Quality

Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge. A phpcs finding can't make a module incompatible.

Static analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

Static analysis results
Tool Status Findings Summary
PHPCS Fail 295 54 errors, 241 warnings (ruleset: Magento2), 15 auto-fixable with phpcbf
PHPMD Warning 17 17 rule violations (MissingImport:6, TooManyPublicMethods:3, ExcessiveMethodLength:3, UnusedLocalVariable:2, UnusedFormalParameter:2)
Cpd Warning 9 9 duplicated chunks spanning 300 total lines (min-lines=5, min-tokens=70)
Composer validate Info 16 valid; 16 advisory notes (composer validate --strict)

PHPStan

Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Error Error
2.4.8 7 7
2.4.9 7 7

Tests

Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 11 11
2.4.8 Pass Pass
2.4.9 Error Error

Integration tests

Integration tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Security

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
License
MIT

More from run_as_root

View vendor
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.