Gift with Purchase (GWP)
Gift with Purchase (GWP) is a popular merchandising technique that offers a gift (free item) to users if their shopping basket satisfies a certain condition. For example:
Buy <something>, get <a product> at 100 percent off.
There are two kinds of GWP:
Non-site catalog gifts
These award items do not appear in the site catalog for users to buy. For example, if a user buys a ten pack of soap, they receive a shampoo sample packet free. The shampoo packet is not in the site catalog, but is offered as a free gift. Therefore, the non-site catalog item price is zero (0) dollars.
Site catalog gifts
These award items appear in the site catalog and are priced. Therefore, after you add a site catalog gift to the basket, the discount system has to apply the 100 percent discount.
GWP discounts only apply if the award item is put in the basket of the user. Although the item is free, the discounting system does not add the item automatically to the basket, which is why you must make custom changes to the discounting system to implement this feature.
To implement the GWP feature, you must do the following:
- Step 1: Determine which items will be free gifts for a given basket.
- Step 2: Add the items you determined to be free gifts to the basket.
- Step 3: Reapply the discounts to the modified basket (this step is only necessary for site catalog gifts).
- Step 4: Other issues that must be considered.
The following steps explain the procedures for steps 1 through 4 above:
Step 1: Determine which items will be free gifts for a given basket
The following code explains how to determine which items will be free gifts for a given basket.
' -----------------------------------------------------
' Free gift retrieving function
' -----------------------------------------------------
' -----------------------------------------------------
' getFreeGifts
'
' Description:
' Given an orderform, the function returns the qualifying items which are
given away Free.
' GWP (Gift With Purchase) discount = Any discount which has award as a
SINGLE ITEM at 100% off
' Eg. Buy A, get B at 100% off
' Buy more than 100$ worth of goods, get B at 100% off
'This function finds out GWP discounts which apply on the ordergroup, and
returns the list of free items.
'Parameters:
' OrderGroup for which the freegifts need to be found out
(Commerce.OrderGroup)
'
'Returns:
' SimpleList of productIDs which are the free Gifts (Commerce.SimpleList)
'
' Notes :
' 1-->This function assumes that there is only a SINGLE orderform by
name "default" in the ordergroup
' 2-->The returned simpleList contains the productIDs (DATABASE::
<CATALOG>_CatalogProducts.productID)
' 3-->It is assumed that an expressionStore object has been
initialized as an application scope object prior to
' calling of this function
' 4-->It is assumed the NAME of the award expression = PRODUCT ID of
the item given as award
' This is the default behavior of the productPicker tool that
comes along with Business Desk.
' If this is not desired, the appropriate XML corresponding to the
expressionID should be extracted from the
' expressionStore, parsed, and the productID has to be found out.
'
' ########################## WARNING #########################
' If the EXPRESSION DEFINITION and the EXPRESSION NAME do not
match as per the assumption above, it will
' lead to inconsistency
' Eg.
' A123 is the productID for "Perforation Photo Paper 4 inches * 6
inches"
' B234 is the productID for "Inkjet Printer model 123"
' Expression: "productName contains INKJET" is named as "A123".
(exprName = A123)
' ----Note that the name of the product A123 DOES NOT CONTAIN
"inkjet"----
' This expression is used in the discount: Buy Anything, get 100%
OFF on product matching expression A123
'
' The expression A123 is met for any state of the basket(since it
is buy anything), and so
' A123 will be added FREE to the basket.
' This is inconsistent.
' ------------------------------------------------------------------------
Function getFreeGifts(mscsOrderGrp)
' Get a list of the discounts the shopper qualifies for, but for
which there is
' no award item (orderform.[_qualifying_discounts])
' But the list may also contain NON GWP DISCOUNTS. So, GWP discounts
have to be separated from others, and returned.
Dim oOrderForm, oQualifyingDiscounts, oQualifyingDiscount,
expressionStore
Dim freeDiscount, allDiscounts, freeItems, tempExprID
set freeItems = Server.CreateObject("Commerce.SimpleList")
set oOrderForm = mscsOrderGrp.Value(ORDERFORMS).Value("default")
' If the "_qualifying_discounts" key does not exist, then just
proceed further, and return the empty simple list
on error resume next
set oQualifyingDiscounts = oOrderForm.[_qualifying_discounts]
if Err.number = 0 then
' The expressionStore object has to be initialised before calling
this function
Set expressionStore = Application("MSCSExpressionStore")
Set allDiscounts = oOrderForm.[_discounts]
for each oQualifyingDiscount in oQualifyingDiscounts
' "item_id" key refers to the campaign item ID (database:::
CAMPAIGN_ITEM.i_campitem_id)
Set freeDiscount = allDiscounts.Search("item_id",
oQualifyingDiscount)
' Only discounts which are ITEMLEVEL (order_level=0), % OFF
(offer_type=2)
' and 100% OFF (offer_value=100) are chosen
if(freeDiscount.Fields("order_level")=0 and
freeDiscount.Fields("offer_type")=2 and
freeDiscount.Fields("offer_value")=100) then
' Assuming that the EXPRESSION NAME = PRODUCT ID
tempExprID = freeDiscount.Fields("award_expr")
freeItems.Add(expressionStore.getExprName(tempExprID))
end if
next
End if
Set getFreeGifts = freeItems
End Function
Step 2: Add the items you determined to be free gifts to the basket
Add the items you determined to be free gifts to the basket.
Step 3: Reapply the discounts to the modified basket
The following pseudo code explains how to refresh the basket page again. Refreshing the basket page will run the Discount pipeline again, which will apply the discount to the newly added item.
If(free gifts added to the basket) {
Refresh the current page
}
Note
- To see if the free gifts are added to the basket, use Step 1.
Step 4: Other issues that must be considered
Steps 1 through 3 handle the automatic addition of items to the basket. The following issues must be considered for consistency:
- When the condition item is removed, the awards are automatically removed.
- If the user adds the free gift award item to the basket, then it is not removed from the basket (even if the condition item is removed).
- The user should have the option of choosing if they want the free item added to their basket. The GWP implementation should not always automatically add the item. For example, if the free gift is sizeable, the user may not want to have it shipped.
See Also
Specifying the Discount Display
Copyright © 2005 Microsoft Corporation.
All rights reserved.