Skip to main content
Version: 2026.10

Product export: FAQ

Overview​

This page answers frequently asked questions about the product export with the ProductAdapterAbstract as of version 12.7.0 of the bundle. Structure and helper methods are described on the page "Build a product export", the behaviour of the import in Shopware on the page "Product import: FAQ". Starting from a symptom, the page "Troubleshooting" leads to cause and solution.


Keys and values​

Which keys may an entry contain?​

The keys of getAllowedProductKeys() and – in translations.<locale> – of getAllowedTranslationKeys(). The defaults are the constants ProductAdapterAbstract::PRODUCT_KEYS and ProductAdapterAbstract::TRANSLATION_KEYS, i.e., all keys that the ProductModule reads (see "Export JSON contract"). The contents of product-extension and custom-fields are not checked.

Why does the export abort with "Unknown key"?​

buildProduct() returns a key that is not allowed – usually a typo such as product-numer or a key in camelCase (productNumber). The ExportException names the key, the object ID and the adapter and aborts the export run. Without the check, Shopware would silently ignore the key.

How is an own key allowed?​

By extending the list, e.g., for a key that an own product module reads:

protected function getAllowedProductKeys(): ?array
{
return [...parent::getAllowedProductKeys(), 'acme-energy-label'];
}

For translations, use getAllowedTranslationKeys() accordingly. The constants themselves are final and cannot be overridden.

How is the check of the keys disabled?​

getAllowedProductKeys() or getAllowedTranslationKeys() returns null. The check of the product keys and of the translations can be disabled independently of each other.

What is the difference between a missing key and null?​

A missing simple key keeps the current value in Shopware. Shopware writes a null as empty value for simple and main products (except stock), for variants null inherits the value of the main product. A null of tax, price or name skips a simple or main product. The bundle delivers the values unchanged, it does not remove null values.

When are relations cleaned up in Shopware?​

With every delivery of an entry. Shopware brings properties, visibilities, prices and, for variants, options exactly to the delivered state – a missing key or [] removes all existing relations of this type. A relation therefore cannot be omitted to keep it in Shopware, relations have to be maintained in Pimcore only. Existing variants that are not part of variants are deactivated by Shopware (see "State synchronisation").

Which fields are required?​

None for the adapter. Shopware requires product-number for every entry and tax, price and translations.<locale>.name in every delivered language for simple and main products, otherwise the entry is skipped with a warning. Variants only require id, uuid and product-number.

What happens if a product has no price?​

preparePrice() returns null if the net or gross price is empty. Shopware skips a simple or main product without price with a warning, an existing product remains unchanged. A variant with price: null inherits the price of its main product. A price of 0 is valid.

Are values converted or formatted?​

No. The bundle delivers the values as buildProduct() returns them: units are not converted and dates have to be delivered as string, e.g., $product->getReleaseDate()?->format(\DateTimeInterface::ATOM). An object such as Carbon would be exported as JSON object.


Variants​

How does buildProduct() recognise that a variant is built?​

Via $mainProduct: for simple and main products the parameter is null, for variants it contains the main product. Whether an object is a main product is decided by getVariants() – if the method returns an iterable, the object is a main product.

Does the main product have to be the parent object in Pimcore?​

No. Only getVariants() defines which objects are exported as variants of a main product. The bundle makes no assumption about the hierarchy in Pimcore.

Where does a complex variant check belong?​

Into prepareListingConditions() (which objects are own entries), isExportable() (which objects and variants are exported, for variants with the main product as second parameter) and getVariants() (which objects are variants of a main product). In buildProduct(), checking $mainProduct is sufficient.

Why are variants exported twice?​

Every object of the listing is exported as an own entry. If variant objects are part of the listing, they appear as own entry and additionally in variants of their main product. Exclude variants from the listing via prepareListingConditions() (see "Step 4: Variants").

What happens to unpublished or non-exportable variants?​

They are missing in variants. Shopware deactivates existing variants that are no longer delivered and reactivates them when they are delivered again.

What happens to a main product without exportable variant?​

It is exported with "variants": []. Shopware skips a main product without valid variant with the warning Product is a represent but has no valid variant and deactivates its variants that are no longer delivered. If the product should appear as simple product in this case, getVariants() returns null.

How does a variant inherit a value of its main product?​

buildProduct() returns null for the variant (or [] for relations), e.g., 'tax' => $mainProduct ? null : 19. The bundle compares no values and does not set null automatically – the project decides which values a variant inherits (see "Inheritance"). A missing key, in contrast, keeps the current value of the variant in Shopware.

What happens to a variant without name?​

If the variant delivers name: null in a language, it inherits the name of its main product there. If it delivers no translations, an existing variant keeps its current names, only a new variant inherits them.


Languages and translations​

Which language does the callback of prepareTranslations() receive?​

Always the Pimcore language (e.g., de), never the Shopware locale. prepareTranslations() writes the result under the Shopware locale from language_mapping (see "Pimcore language and Shopware locale").

Why is a language missing in the export?​

prepareTranslations() only returns languages that are listed in supported_languages of the export target (without a value: all), valid and enabled in Pimcore and not part of disabled_languages, and for which the callback does not return null. The command preview-product warns if entries of supported_languages are not enabled Pimcore languages or if no language is exported.

How do I export only some languages?​

With supported_languages on the export target, e.g., to deliver different languages to different shops. Specify Pimcore languages, the Shopware locale still comes from language_mapping (see "Configure Language Mapping").

Which Shopware locales may be used in language_mapping?​

Shopware takes over locales with an underscore (e.g., de_CH) unchanged, maps short forms such as de via JsonImportConfiguration::getLocaleMapping() and ignores keys with a hyphen (e.g., de-DE) as well as locales without a language in Shopware. The mapping on the Shopware side can be adjusted via the LocaleMappingEvent (see "Which locales are accepted?").

How are empty names filled from another language?​

With applyTranslationFallback($translations, ['name'], ['de', 'en']): empty values of the given fields are filled from the first language of the list with a value, without a match from the first language with a value. The list expects Pimcore languages. The fallback is optional and only applied if the project calls it.

Why is a translation key not written in Shopware?​

Shopware only writes the keys of ProductModule::getProductTranslationKeyMap(). Further keys have to be added there (see "Hooks and helper methods") and allowed in Pimcore via getAllowedTranslationKeys().


Custom fields and product extension​

When is custom-fields and when translations.<locale>.custom-fields used?​

custom-fields for values that are not translated – Shopware writes them into all languages by default. translations.<locale>.custom-fields for translated values that are only written into their language. If a name is delivered in both places, the translated value applies in its language. The key is the technical name of the custom field in Shopware, a value can itself be an array or JSON object.

How is a custom field removed?​

With the value null. Shopware removes the own value, a variant then inherits from the main product again. A name that is not delivered keeps its value, unless the custom field belongs to a set of getManagedCustomFieldSets() of the product module.

What happens to unknown custom fields or invalid values?​

Shopware reports them as warning and does not write them, the rest of the entry is imported. A name is known if it is an active custom field of a set that is assigned to products. An invalid value keeps the current value.

How is the product extension delivered?​

As plain array under product-extension, translated fields under product-extension.translations.<locale> (e.g., via prepareTranslations()). The bundle does not check the contents. In Shopware, the keys have to be mapped in getProductExtensionFieldMap() or getProductExtensionTranslationKeyMap(), keys that are not mapped are ignored (see "Product import: Product extension").


Master data​

How is the tax rate set?​

As value of tax in buildProduct(), e.g., 'tax' => $mainProduct ? null : 19. The bundle does not define a tax rate.

How is the assignment of a manufacturer or delivery time removed?​

prepareManufacturer('') returns [] and removes the assignment of the manufacturer, 'delivery-time' => '' the one of the delivery time. A missing key keeps the assignment, for variants null inherits the value of the main product. Existing manufacturers are never changed in Shopware, link and description only apply on creation.

Which units are allowed for the delivery time?​

prepareDeliveryTime() expects hour, day, week, month or year as $unit. Other units (and min greater than max) are reported as warning by the import and the delivery time is not written. Alternatively, the UUID of an existing delivery time can be delivered (see "How is the delivery time delivered?"). $names of prepareDeliveryTime() and $descriptions of prepareManufacturer() expect the Pimcore language as key.


Checksums and delta export​

How does the delta export detect changes?​

Via a checksum (md5) of the complete entry per object of the listing, compared with the last successful export to the same export target. The result of buildProduct() is decisive, not the modification date of the object. Variants are part of the entry of their main product: if a variant changes, the main product including all variants is transferred.

Why is a product transferred in every delta export?​

buildProduct() returns a different value in every run, e.g., a timestamp, a changing order of relations or values from beforeConvert() that change per run. The values must be identical for unchanged data. Changes of the adapter, of language_mapping or of the cross-selling change the checksum as well – the affected products are transferred once.

Why is the cross-selling missing in the export?​

The package cross-selling only contains the cross-selling of adapters that use the CrossSellingTrait and implement the CrossSellingProviderInterface. It is collected when getCrossSellingChecksum() or prepareCrossSelling() is called – buildProduct() therefore has to return 'cross-selling-checksum' => $this->getCrossSellingChecksum($product) (see "Step 8: Cross-selling").


Deletion, publication and errors​

What happens to unpublished objects?​

Unpublished objects of the listing are transferred as deleted (.meta.deleted) if the export target has has_delta_management. The same applies to objects for which isExportable() returns false. Shopware does not delete products, but deactivates them. Unpublished variants are missing in variants and are deactivated as well.

How is a product prevented from being deactivated in Shopware?​

The object has to stay exportable (isExportable() returns true) and published. If a published object should neither be exported nor transferred as deleted in a run, prepare() can return ['.meta' => ['skip' => true]] for this object and otherwise call parent::prepare($object) – the entry remains unchanged in Shopware. Without has_delta_management of the export target, no deletion entries are transferred.

What happens on an exception in buildProduct()?​

The exception – also the ExportException of an unknown key – aborts the whole export run. The command preview-product prints the message without stack trace and is therefore suitable to analyse a single object.


Check and migration​

How is a product checked?​

With php bin/console twocream:shopware-connector:preview-product <object ID> --system=<export target>. The command prints the entry that the product adapters of the class export for the object, without storing checksums or writing an export file. --system is required, as buildProduct() may use the export target (e.g., assetHelper(), copied assets end up in the asset directory of the export target), see "Commands".

How is an existing adapter with export array migrated?​

BeforeWith the ProductAdapterAbstract
prepare() returns an array with id, uuid and the keysbuildProduct() returns the keys, id and uuid are set by the adapter (different UUID via generateUuid())
Loop over the variants in prepare()getVariants(), variants are built with buildProduct($variant, $product)
Role check in prepare() and in every helperprepareListingConditions(), isExportable(), getVariants() and $mainProduct
translations with Shopware locales via getShopwareExportLanguage()prepareTranslations() with Pimcore languages
Own fallback (e.g., setFallbackTranslationValues())applyTranslationFallback() with Pimcore languages
Name of the main product copied into the variantsname: null for the variant, Shopware inherits the name
Fixed placeholders (e.g., price 999999.99, stock 999999, minimum purchase 1)Only deliver what the project actually has
Own formatting of prices, visibilities, manufacturers and delivery timespreparePrice(), prepareRulePrice(), prepareVisibility(), prepareManufacturer(), prepareDeliveryTime()
customFields via getAdditionalProductData() in the product modulecustom-fields or translations.<locale>.custom-fields
Overridden convert() for preloadingbeforeConvert()

Afterwards, check the result with preview-product and compare it with an export of the previous adapter.

What has to be considered for existing methods getRelationIds() or getRelationIdsByFieldName()?​

As of version 12.7.0, the ArrayAdapterAbstract has the methods getRelationIds(iterable $relations): array and getRelationIdsByFieldName(Concrete $object, string $fieldName): array (protected). Methods with the same name in project adapters need a compatible signature, final is allowed in the project adapter. An incompatible signature leads to a fatal error. Own copies can usually be removed.

Can prepare() still be implemented by the project?​

prepare() is not final, but an own implementation replaces the variant structure, id/uuid and the check of the keys. If prepare() has to be overridden (e.g., for .meta.skip), call parent::prepare($object).

Are properties from the Product-Attribute-Bundle supported?​

Yes. ProductAttributeService::getArticleAssignmentByProductId() returns the properties as list [{id, uuid}], which can be delivered directly as properties. Inject the service via the constructor of the own adapter (see "Complete example").