# Import & Export

EasyCoupon brings a profile for the Shopware Standard Import / Export module to easily import and export coupons.

Attention

As of version 5.5.0, the reduce_shipping_costs field has been removed. Please check your import file.

# File structure and fields

The structure of the CSV file. All fields must be used.

Feld Nullable Datentyp Beispiel Erklärung
id ja STRING e6d5c97c13c244d98ff779f26d5391f5 ID des Gutscheins
title nein STRING 10 EUR Gutschein Titel des Gutscheines
deleted nein INTEGER 0 oder 1 Gelöschter Gutschein
deleted_date ja STRING 2022-01-17 14:55:30.086 Löschdatum
active nein INTEGER 1 oder 0 Status des Gutscheins
voucher_type nein INTEGER 40010 (allgemeingültig) oder 40020 (individuell) Beschreibung
code nein STRING zfxk-fdzw-13 Gutscheincode
value nein FLOAT 13.37 Aktueller Wert des Gutscheins Shop Standardwährung
value_type nein INTEGER 10010 absolut oder 10020 prozentual Typ des Rabatts. Absolut oder prozentual.
comment ja STRING Interner Kommentar Kommentarfeld
discard_remaining nein INTEGER 0 oder 1 Restwert verfällt
mail_sent nein INTEGER 0 oder 1 Status ob Mail mit Code versendet wurde
combine_vouchers nein INTEGER 1 oder 0 Gutschein darf mit weiteren Gutscheinen kombiniert werden
currency_factor nein INTEGER 1 (Wenn z.B. EUR Standardwährung) Faktor der aktiven Währung
order_position_number nein STRING 1337-voucher Produktnummer bei Einlösung des Gutscheins
max_redemption_value ja FLOAT 100.37 Maximaler Einlösewert je Kunde
currency_iso_code nein STRING EUR Währung des Gutscheins
virtual_import nein STRING {} Spezialfeld siehe Erklärung
valid_until ja DateTime 2022-01-17 14:55:30.086 Ablaufdatum
redemption_order nein INTEGER 0 Reihenfolge beim Einlösen mit den SW-Promotions
pin yes STRING 0123 (if null a 4-digit pin will be created automatically) pin to query voucher balance
initial_value yes Float 20.00 This field is only available in export and is ignored during import
tax_id ys STRING 1dd7ad4e58374fd8b3aae629f6f6d94c ID of tax
discount_scope ja STRING cart Type of the discount(cart, delivery, cartAndDelivery)
discount_rules ja STRING 018cc9ec54fb725e9ecd296f035ea38b|018cc9ec5fb67302ba6933b74aae75a9 IDs of the rules divided by |

# Import

# Minimal Import

Example of a minimal import of the vouchers in which there is no assignment to existing customers.

id title deleted deleted_date active voucher_type code value value_type comment discard_remaining mail_sent combine_vouchers currency_factor order_position_number max_redemption_value currency_iso_code virtual_import valid_until redemption_order pin discount_scope discount_rules
Einfacher Gutschein 0 1 40010 zfxk-fdzw-11 50 10010 Importierter Gutschein 0 0 0 1 Basis Gutschein EUR {} 0 cart

Here you will find an example file.

# Import with customer assignment

In this example, the voucher is assigned to the customer with ID 10059.

id title deleted deleted_date active voucher_type code value value_type comment discard_remaining mail_sent combine_vouchers currency_factor order_position_number max_redemption_value currency_iso_code virtual_import valid_until redemption_order pin discount_scope discount_rules
Einfacher Gutschein mit Kundenzuweisung 0 1 40010 zfxk-fdzw-13 50 10010 Importierter Gutschein 0 0 0 1 Basis Gutschein EUR {"customerNumber":"10059"} 0 cart

In column virtual_import with JSON

{"customerNumber":"10059"}
1

for the assignment to the customer.

Attention

Please make sure that the customer ID actually exists. Otherwise, no assignment will be made.

Here you will find an example file.

# Import with order data

In this example, the voucher is imported with the order data. The connection to the order can be established using the order number orderNumber. If the item number of the purchased voucher orderLineItemNumber is also specified, the status can be queried correctly (open/paid)

id title deleted deleted_date active voucher_type code value value_type comment discard_remaining mail_sent combine_vouchers currency_factor order_position_number max_redemption_value currency_iso_code virtual_import valid_until redemption_order pin discount_scope discount_rules
Einfacher Gutschein mit Bestelldaten 0 1 40010 zfxk-fdzw-13 50 10010 Importierter Gutschein 0 0 0 1 Basis Gutschein EUR {"orderNumber":"10013","orderLineItemNumber":"SW10000"} 0 cart

In column virtual_import with JSON

{"orderNumber":"10013","orderLineItemNumber":"SW10000"}
1

the assignment to the order and the item is made.

Attention

Please make sure that the order number actually exists. Otherwise, no assignment will be made.

Here you will find an example file.

# Import with voucher rules

Example for importing the vouchers with rules.

id title deleted deleted_date active voucher_type code value value_type comment discard_remaining mail_sent combine_vouchers currency_factor order_position_number max_redemption_value currency_iso_code virtual_import valid_until redemption_order pin discount_scope discount_rules
Voucher with rules 0 1 40010 rqvt-ejdc-62 50 10010 Voucher conditions 0 0 0 1 Base Voucher 1 EUR {""conditions"":[{""id"":""443ce75951244e5395ac7d4ee101c4c1"",""couponId"":""4a7646ca24344c9b846fe3deb225766b"",""parentId"":""e6d5c97c13c244d98ff779f26d5391f5"",""value"":[],""position"":0,""type"":""andContainer""},{""id"":""e6d5c97c13c244d98ff779f26d5391f5"",""couponId"":""4a7646ca24344c9b846fe3deb225766b"",""parentId"":null,""value"":[],""position"":0,""type"":""orContainer""},{""id"":""78b1d32101fc429b8fe8a1b8d5cacdcf"",""couponId"":""4a7646ca24344c9b846fe3deb225766b"",""parentId"":""443ce75951244e5395ac7d4ee101c4c1"",""value"":{""amount"":25,""operator"":"">""},""position"":0,""type"":""cartCartAmount""}]} 0 cart

In column virtual_import with JSON

{""conditions"":[{""id"":""443ce75951244e5395ac7d4ee101c4c1"",""couponId"":""4a7646ca24344c9b846fe3deb225766b"",""parentId"":""e6d5c97c13c244d98ff779f26d5391f5"",""value"":[],""position"":0,""type"":""andContainer""},{""id"":""e6d5c97c13c244d98ff779f26d5391f5"",""couponId"":""4a7646ca24344c9b846fe3deb225766b"",""parentId"":null,""value"":[],""position"":0,""type"":""orContainer""},{""id"":""78b1d32101fc429b8fe8a1b8d5cacdcf"",""couponId"":""4a7646ca24344c9b846fe3deb225766b"",""parentId"":""443ce75951244e5395ac7d4ee101c4c1"",""value"":{""amount"":25,""operator"":"">""},""position"":0,""type"":""cartCartAmount""}]}
1

of the rules of the voucher imported

Hier you will find an example file.

# Import with customer and voucher rules assigned

Example of importing the vouchers with existing customers and rules.

id title deleted deleted_date active voucher_type code value value_type comment discard_remaining mail_sent combine_vouchers currency_factor order_position_number max_redemption_value currency_iso_code virtual_import valid_until redemption_order pin discount_scope discount_rules
Vouher with rules 0 1 40010 rqvt-ejdc-62 50 10010 Voucher conditions 0 0 0 1 Basis Gutschein EUR {""customerNumber"":""10059"",""conditions"":[{""id"":""443ce75951244e5395ac7d4ee101c4c1"",""couponId"":""4a7646ca24344c9b846fe3deb225766b"",""parentId"":""e6d5c97c13c244d98ff779f26d5391f5"",""value"":[],""position"":0,""type"":""andContainer""},{""id"":""e6d5c97c13c244d98ff779f26d5391f5"",""couponId"":""4a7646ca24344c9b846fe3deb225766b"",""parentId"":null,""value"":[],""position"":0,""type"":""orContainer""},{""id"":""78b1d32101fc429b8fe8a1b8d5cacdcf"",""couponId"":""4a7646ca24344c9b846fe3deb225766b"",""parentId"":""443ce75951244e5395ac7d4ee101c4c1"",""value"":{""amount"":25,""operator"":"">""},""position"":0,""type"":""cartCartAmount""}]} 0 cart

In column virtual_import the assignment to the customer and the voucher rule are made

{"customerNumber":"10059","conditions":[{"id":"100014784a9e43dc9756e6afe3c3add0","couponId":"cfcc7faf35814480af80fd53ff3ec1d1","parentId":"b86a75a10ab044989269a209d4839cc5","value":{"amount":10,"operator":">"},"position":0,"type":"cartCartAmount"},{"id":"3e2481698d804d90a3f8d331f3a2e9e2","couponId":"cfcc7faf35814480af80fd53ff3ec1d1","parentId":null,"value":[],"position":0,"type":"orContainer"},{"id":"b86a75a10ab044989269a209d4839cc5","couponId":"cfcc7faf35814480af80fd53ff3ec1d1","parentId":"3e2481698d804d90a3f8d331f3a2e9e2","value":[],"position":0,"type":"andContainer"}]}
1

Here you will find an example file.

# Import from EasyCoupon for Shopware 5

  • Export the coupons from EasyCoupon for Shopware 5 overview

EasyCoupon Export

  • Adjust the format of the file to the format you need (minimal import, import with customer mapping or import with coupon rules)
  • Import the file Admin > Settings > Shop > Import/Export > Import and select the profile EasyCoupon to import all coupons.

# Export

Go to Admin > configuration > Shop > Import/Export > Export choose profile EasyCoupon to export all vouchers.

# Profile Changes

You can create a profile with the object type EasyCoupon or change the existing profile. When changing the profile you will get an error that the createdAt and currencyId fields are missing. You can add these fields and then make your changes. With the import/export, we have also built in a lot of logic when writing or importing the data. If some fields are missing or not mapped correctly, the profile may not work at all. Please keep this in mind when making changes.