Developer Documentation

Single Gift Promotions

Set/update gifted line item properties before Enticify adds them to the customer basket.

IF YOU ARE USING ENTICIFY 2.7 OR LATER, YOU NEED THE NEW GIFT WITH PURCHASE GUIDE.

Identifying Gifted Basket Line Items

We provide a LineItem extension method for this purpose.

  1. Add using statement for Enticify.Promotions
  2. LineItem instances now have method bool IsGiftWithPurchaseAutoAddedLineItem()

Gift Line Item Properties

The gift line item is added after some of the standard pipeline components and potentially some of your own custom pipeline components. Therefore, it is important that we provide you with a way to set properties on these freshly minted gift lines.

You need to make sure that all the properties you require are added to the gifted line items. We provide you with the mechanism to do this.

Properties Set by Enticify

When a customer qualifies for the gift with purchase discounts, Enticify creates a new basket line item and sets the following properties on it:

  • product_catalog - set with the catalog name you specified in the product picker.
  • product_id - set with the product id you specified in the product picker.
  • _cy_iadjust_regularprice - set to 0 (as the item is free).
  • quantity - set to the value you set for the discount Award Limit.
  • index - set with a new Guid identifier for the line.

Setting Additional Properties

Do the following to update/set additional properties of the gifted line item immediately after Enticify adds it:

  • Add a reference to Enticify.dll.
  • Add a new class to your solution and add using Enticify.Promotions.Advanced
  • Implement the Enticify interface IAutoAddedGiftLineItemUpdater on your new class.
  • Add & update line item properties in the implemented method UpdateAutoAddedLineItemGift. This is called with the lineItemGift line item dictionary.
  • Register the assembly containing this class with Enticify by calling EnticifyExtensions.RegisterFromAssemblies(assemblies) once in the application on start.

Auto Add Gift Shipping Assignment

You will need to assign the auto gifted items to shipments. When using Enticify, shipping components are run before the discounts are applied. Therefore, you will need to assign the auto-added items to a shipment (or create a new shipment if you wish). You can do this inside your IAutoAddedGiftLineItemUpdater (as we provide you the OrderForm dictionary).

Adding Variant Gift Lines

The Commerce Server discount product picker does not allow you to pick a product variant. Therefore, you must add the variant id property in your IAutoAddedGiftLineItemUpdater implementation. There are a number of ways we could make this configurable directly in Markerting Manager. Please contact us to discuss this.

The following code demonstrates how you might set the variant id of an auto-added item and allocate the new basket line to a shipment. Note: This example assumes you have a single shipment.