You are here:
Coupons and Coupon Code Object Import/Export in B2C Commerce
Coupons are imported as XML and exported as comma-separated value (CSV) files. Use the coupon.xsd schema file to import merchant-generated coupons. This topic applies to B2C Commerce.
The system trims coupon codes with leading or trailing spaces during export and logs a warning message.
Business Manager Import Location
Coupon Import
Coupon import and the Business Manager coupon user interface have the same validation restrictions, as follows:
They don't allow:
- Negative numbers for limit-per-code, limit-per-customer, limit-per-time-frame>limit or limit-per-time-frame>time-frame; and for max-number-of-codes of system-generated coupon codes.
- Limit-per-time-frame>time-frame to be greater than 999.
- Changing the type of a coupon (except for in REPLACE mode).
- Creating a system-code coupon without a maximum number of codes.
They allow:
- Removal of the prefix for system-generated coupon codes when it's set to an empty string.
- Updating of system-generated code settings, as long as the coupon hasn’t been redeemed or issued.
- Updating of single-code coupons, even if the unchanged code is in the xml file.
Pipelets
ImportCoupons
ExportCouponCodes
ExportCoupons
Granularity: passed coupons.
Coupons Import/Export for Promotions in B2C Commerce
Coupons (not individual coupon codes) This topic applies to B2C Commerce.
The following are the ways that you can import/export coupon data:
- Definitions: You can import and export coupon definitions.
- Import: You can import coupon codes generated by external tools
- Export: You can export issued and redeemed codes, independent from the actual coupon definition export mentioned previously.
Use coupon.xsd to define the import/export file for your coupon codes.
- The
<RedemptionLimits><limit-per-code>element is a required field, but this element can't be declared due to update modes. If the element isn't specified for new coupons, the system sets the limit to one and logs a warning - The
<CouponCodes>element supports incremental updates to the set of existing (fixed, multi-code) coupons. This functionality is useful when coupon codes are provided in chunks by external systems and must be imported (for example, 1000 new codes per month).
Coupon Redemptions Import/Export in B2C Commerce
Coupon redemptions can appear in order exports. This topic applies to B2C Commerce.
The following XML sample shows an order export that includes coupon code redemption data. Coupon redemptions are also visible by selecting .
You can import/export coupon redemptions in the XML format, or one code at a time in the CSV format. However, only import coupon redemptions in rare cases. Before you export coupon redemptions from one instance and import them into another, make sure that all appropriate coupon and order information were already imported. Otherwise, the import can fail to work as expected.
<?xml version="1.0" encoding="UTF-8"?><orders xmlns="http://www.demandware.com/xml/impex/order/2006-10-31">
<order order-no="00000004">
<order-date>2008-10-07T17:07:50.585Z</order-date>
. . .
<product-lineitems>
<product-lineitem>
<net-price>449.00</net-price>
<tax>17.96</tax>
<gross-price>466.96</gross-price>
<base-price>449.00</base-price>
. . .
<price-adjustments>
<price-adjustment>
Net price adjustment
<net-price>-44.90</net-price>
Tax adjustment
<tax>-1.80</tax>
Gross price adjustment
<gross-price>-46.70</gross-price>
Base price adjustment
<base-price>-44.90</base-price>
Coupon ID
<lineitem-text>10PercentOff</lineitem-text>
Promotion ID
<promotion-id>10PercentOff</promotion-id>
Campaign
<campaign-id>Demo Campaign</campaign-id>
Coupon Number
<coupon-id>a1</coupon-id>
</price-adjustment>
</price-adjustments>
</product-lineitem>
</product-lineitems>
...
</order>
</orders>
Sample Coupon XML File in B2C Commerce
You can create coupons through Business Manager or by importing coupon definitions in XML format. The following XML example shows the main elements of the coupon import format. This topic applies to B2C Commerce.
<coupons>
This coupon definition shows that it allows up to 500 redemptions, 1 per customer, and up to 5 per week per customer.
<coupon coupon-id="myCoupon">
<description>The coupon description</description>
<enabled-flag>true</enabled-flag>
<redemption-limits>
<limit-per-code>500</limit-per-code>
<limit-per-customer>1</limit-per-customer>
<limit-per-timeframe time-frame="week">5</limit-per-timeframe>
</redemption-limits>
By default, all coupons are case-sensitive. If the coupon code is case-insensitive, it would be defined here. This definition works only for coupons with no existing codes.
<case-insensitive>true</case-insensitive>
If the coupon had a single code, it would be defined here.
<single-code>DRR94IGB49S</single-code>
If the coupon had system-generated codes, in this example, the prefix would be "ABC", with up to 1000 issued.
<virtual-codes>
<code-prefix>ABC</code-prefix>
<code-limit>1000</code-limit>
<virtual-codes>
If the coupon had multiple codes, they would be listed here. For coupons with large numbers of codes, use system-generated coupons. See System-Generated Coupon Codes.
</coupon>
<coupon-codes coupon-id="myCoupon">
<code>ABEEO48HD4C</code>
<code>ABRREO48H7F</code>
</coupon-codes>
...
</coupons>

