Shopware Product Weight Import/Export: Navigating Unit Conversions and Decimal Quirks
Understanding Shopware Product Weight Import/Export Challenges
The Shopware community recently discussed a puzzling issue concerning product weight import and export, highlighting inconsistencies that can lead to significant data errors. The core problem, as reported by a user, involved Shopware's handling of product weights set in grams (g) during export and subsequent re-import.
The user observed that when exporting product weights, the system exhibited inconsistent behavior: some 100g items were exported as 0.1 (implying a conversion to kilograms), while others, like 30g, were exported as 30 (retaining the gram value). The situation escalated upon re-importing these values. For instance, if the exported 0.1 (intended for 100g) was manually changed to 100 in the spreadsheet and re-imported, Shopware would display it as an astounding 100000g. Similarly, re-importing an unchanged 30 (for 30g) resulted in 30000g.
Key Insights and Potential Causes
- Internal Unit Storage: It was clarified that Shopware internally stores product weights in kilograms (kg). This fundamental design choice means that any input or export in grams requires a conversion, which isn't always transparent or consistent to the user.
- Inconsistent Export Formatting: The varied export formats (some converted to kg with decimals, others remaining as raw gram values) are a major source of confusion. This inconsistency makes it difficult for users to predict how values should be formatted for re-import.
- Decimal Separator Issues: A crucial point raised by the community was the potential for spreadsheet software, particularly in different locales (e.g., German Excel), to misinterpret decimal separators. In many European countries, a comma (
,) is used as a decimal separator, while Shopware's internal or export format might default to a point (.). This mismatch can cause numbers like0.1to be read as1(if the point is ignored) or lead to incorrect scaling. - Sales Channel Configuration: The default weight unit setting within the Shopware Sales Channel configuration (German: Verkaufskanal) was identified as a critical area to check. This setting dictates how Shopware interprets and displays weight values, potentially influencing import/export behavior.
- Conversion Discrepancies: The observed re-import behavior (e.g.,
30becoming30000g) strongly suggests that Shopware is interpreting the imported value as kilograms and then converting it back to grams for display, leading to a 1000x multiplication error if the original value was intended as grams. For example, if30was meant as 30g, but Shopware interprets it as 30kg, it stores 30kg. If the display then converts 30kg to grams, it becomes 30000g.
Actionable Recommendations for Merchants and Developers
To avoid these common pitfalls when managing product weights in Shopware:
- Understand Internal Storage: Always remember that Shopware stores weights internally in kilograms. When preparing data for import, convert your gram values to kilograms (e.g., 100g becomes 0.1, 500g becomes 0.5, 1000g becomes 1).
- Standardize Decimal Separators: Ensure consistency in decimal separators. If your Shopware instance expects a point (
.) for decimals, configure your spreadsheet software (e.g., Excel, LibreOffice Calc) to use a point as the decimal separator during CSV export, or adjust the imported data accordingly. This is a frequent cause of import errors. - Verify Sales Channel Settings: Double-check the default weight unit setting in your Shopware Sales Channel configuration (
Einstellungen > Shop > Verkaufskanäle > [Your Sales Channel] > Grundeinstellungen > Standard-Gewichtseinheit). While it might not resolve all export inconsistencies, it's crucial for correct display and internal processing. - Test with Small Datasets: Before performing a large-scale import or export, test the process with a few sample products covering different weight ranges (e.g., 50g, 500g, 1500g). This allows you to observe the exact export format and verify the re-import behavior without risking your entire product catalog.
- Review Exported Data Carefully: After exporting, meticulously review the weight column. If you see values like
0.05for 50g, you know Shopware has converted to kilograms. If you see50for 50g, be cautious during re-import, as Shopware might interpret it as 50kg.
While the forum thread didn't yield an official bug fix, the community's insights provide valuable guidance for navigating Shopware's weight import/export functionalities, emphasizing careful data preparation and an understanding of Shopware's internal unit handling.