Feature - Promo code at checkout page

Table of Contents


Problem statement

It was requested the ability to use a loyalty promo code through the checkout page. With that in mind, we extended the loyalty feature that before could only be used on /offers page.

The idea is to improve the user experience because the user now has the ability to add offers without the need to go back to the /offers page. The goal is to make it easier to redeem the offers, to ensure that customers perceive the value of this type of promotions. This will generate higher engagement / usage, and the end goal is to increase the overall order value, quantity and ultimately total revenue.

PS: This feature reused part of the deprecated/removed CBA Offers code. We are also using part of the loyalty offers logic to control the implementation.

For the feature to work as expected, the promo code should be configured using Sanity and the desired campaign tool (Voucherify, etc). The setup instructions are available here: Promo Codes Content Setup.

Solution restrictions:

  • The Item; Offer Activation; Swap are legacy options that came from the US fork and will not work for now.  

  • Currently, the promo code at checkout will only support the following types of “In-App Benefits” configured: Combo; Picker; Discount.

image-20240517-145726.png
Currently supported “In-App Benefits”

 

  • Even if Sanity shows a list of “In-App Benefits” the legacy code for this will only support only one item independently of the type


Business requirements

  • The user should not be redirected to the menu page when applying a promotional code directly through the checkout page (for Offer Combo/Picker)

  • Add the offer item with the default selections for the Combo/Picker

  • Show the “edit” button on the cart offer item. The edit button should send the user to the menu page for the edited item

  • The behavior must be closely related to the legacy flow /offer page:

    • The item added to the cart should be exactly as we are adding it through the legacy flow /offer (sub-items, price, etc)

    • The item should be correct at Recent Orders or Email Receipt (like the legacy /offers flow).

    • The offer item should not be available to add again to a new order after being used (blocked by the application by default)

  • Only one offer item can be added by default. If the user tries to add another offer (Combo, Picker/Offer Discount), a modal will ask if the user wants to replace the current added offer with the new one.

  • If the user tries to apply the same code twice, the application should block this showing an error about “promo code already applied”

  • The feature should respect the rules from Sanity or the campaign platform. For example, if the user already finishes an order for a promo code that only has one available, they should not be able to reuse that promo code

  • The application should show the same errors that we already have for promotional codes (the old deprecated/removed CBA flow):

    • Unknown exception error

    • Code expired

    • Invalid code

    • Code already redeemed

    • Invalid Offer ID

    • Promo code already applied


Whitelabel solution

image-20240517-162609.png
Promo code field at checkout page

General behavior demonstration

How will the look and feel for Combo/Picker be after it is added to the cart

About the final price

As shown in the screenshot above, the Combo/Picker will not show what the discount was or a "discount value". Why?

  • Today our app doesn't have a discount at the item level

  • For the feature to work, we need to create an “Offer Combo” or “Offer Picker” on Sanity. This means that we always have an exclusive new item created for the promotion, and this item will already have the final price considering the promotion/discount

  • For the cart, total, subtotal, receipt, and email receipt, the prices will not show any different information about the offer

  • Important: when configuring the campaign platform (Voucherify, etc.), the type of discount in the coupon or the value of the coupon will not be used at all. The value for Combo/Picker will come from Sanity vendor configs. We can set 0 as value in the campaign platform.

 

PS: What can be different between Combo/Picker is the sub-items shown in the card. Sometimes the Picker will be converted as a single item and will not have any sub-items.

Videos demonstrations:

Adding a Combo

 

Adding an Offer Discount at checkout

About the final price

  • As shown in the screenshot above, the “Offer Discount” is not considered a "cart item" (as a product, for example). We can think of this as an "informative card"

  • The "Offer Discount" will have a discount applied to the final price of the cart (total cart). The type of discount can be “Amount” (absolute value discounted) or “Percentage”

     

    For the screenshot above we can imagine that we have a Offer Discount of 50% applied. The sum of prices and taxes will be something close to 20 but the final value will be half of that.

    PS: Please disregard if the values are not exact in the screenshot above, as this comes from a dev environment and we have some problems with value consistency. The important thing here is the idea/behavior.

  • Important: when configuring the campaign platform (Voucherify, etc.), we need to select the coupon to be a percentage or fixed value as well to ensure the correct behavior

How we’ll show the errors

  • For errors that are related to the promo code when applying/redeem we’ll show the error below the promo code field

     

  • For errors that are related to the Sanity rules the application can show the error in two places

    • Inside the “header” of the Offer item added into the cart

    • Above the “continue” checkout page button. This use case is not the most common, and we don’t have all the scenarios mapped as this is legacy code. Please disregard the message, as the idea here is only to show where the error can appear.

About the edit button

As the user is adding the offer directly to the checkout page, he/she needs the ability to edit the offer item if he/she wants to change some of the items. This can also be used as a “shortcut” to offer up-sells during the edit time.

Videos demonstrations:

Replace logic example

The visual is standardized and will be the same that we also have on the /offers page.

Videos demonstrations:

Relationship between /offers page and promo code at checkout and reuse

As this feature uses the loyalty offer structure in its implementation, we'll have some states and connected behaviors:

  • Always, when we redeem an offer on the checkout page, this offer will also be available on the /offers page to be used later (e.g., when the user, for example, adds the offer on the checkout page but for some reason doesn't finish the order using that promo code)

  • The user can reuse a promo code until he/she finishes the order (as a default). Of course, this can be changed based on the Sanity rules for the configured offer. If the promo code is not valid anymore, an error will alert the user about it

Videos demonstrations:

In the video below, we can see that after replacing an offer, the replaced offer will also be selected on the /offers page as the current selected offer.

 

FAQ

Golden rule

Most of the behaviors will be equal to what we have on the /offers page. If we don’t know if something is a bug or not, we need to first check the behavior of the offer if we add it through the /offers page.

Partners integration and POS vendors

For Combo/Picker what's the difference from what we have on the /offers page?

Can we replace an offer at the checkout page?

Can we edit the Combo/Picker in the cart preview?

After adding the offer to the cart, the price is wrong, or I'm receiving an error saying that the offer is not available at the selected restaurant or that the product added is invalid

Lokalize keys

For the errors:

  • promoCodeOfferUnknownException: default error if the backend or campaign platform doesn't return a specific one. 

  • promoCodeOfferExpiredCode: for the expired code message

  • promoCodeOfferInvalidCode: for the invalid code message

  • promoCodeOfferRedeemedCode: for the already redeemed code

  • invalidOfferId: invalid offer id configured in the offer message (for bad setup)

  • promoCodeAlreadyApplied: message when a code is already applied

 

For the promo code button texts:

  • apply: the text for the apply button. As this is a very generic key is not recommended to change because can affect other places

  • enterPromoCode: the label of the input

Feature Flags

  • enable-edit-cart: general flag to control edit cart option

  • enable-offers-edit-cart: flag to turn on the edit button at offers cart items

  • enable-loyalty-offer-promo-code-at-checkout: a main flag to disable/enable the whole feature

  • enablePromoCodeAtCheckout: This is legacy flag that already exists and control the promo code besides our feature. Needs to be on too if we want the feature to be working