Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Marketing Library

The Marketing library in Ucommerce, enables you to easily integrate your marketing campaigns in your web-applications.

Most of the things that goes on in Marketing foundation happens automatically in the basket pipeline. However adding a voucher is an action performed by the user, and needs to be called by the API.

Ucommerce.Api.IMarketingLibrary

Methods


AddVoucher

  • Description
    Adds voucher code to the user's current basket.
  • Arguments
    • string voucherCode: The voucher code.
  • Return type Boolean

GetTargetedCampaignItems

  • Arguments
    • This method is called without any arguments
  • Return type IList<Ucommerce.EntitiesV2.CampaignItem>

GetTargetedCampaignItems

  • Description
    Gets all campaign items, which targets are satisfied, for the given Product.
  • Arguments
    • Ucommerce.EntitiesV2.Product product
  • Return type IList<Ucommerce.EntitiesV2.CampaignItem>

GetTargetedCampaignItemsForIndividualProducts

  • Description
    Gets lists of all campaign items, which have targets satisfied for each of the products given.
  • Arguments
    • IEnumerable<Ucommerce.EntitiesV2.Product> products
  • Return type IList<IList<Ucommerce.EntitiesV2.CampaignItem>>

GetSingleProductCampaignItems

  • Arguments
    • This method is called without any arguments
  • Return type ICollection<Ucommerce.EntitiesV2.CampaignItem>

Adding a Voucher

Vouchers are typed into the UI by the customer, so Ucommerce needs to pick up when this happens. This is done using MarketingLibrary.AddVoucher.

Ucommerce.Api.IMarketingLibrary.AddVoucher

  • Description
    Adds voucher code to the user's current basket.
  • Return type Boolean
  • Arguments
    • System.String voucherCode : The voucher code.

Calling the API

    
    var marketingLibrary = Ucommerce.Infrastructure.ObjectFactory.Instance.Resolve<Ucommerce.Api.IMarketingLibrary>();
    marketingLibrary.AddVoucher(voucherCode);
    

Get Targeted Campaign Items

The GetTargetedCampaignItems() method gives you a list of the targeted campaign items for the current user context. For example all discounts that are relevant to the category or product the user is visiting. For example you can use GetTargetedCampaignItems.

Ucommerce.Api.IMarketingLibrary.GetTargetedCampaignItems

Additional overloads to this method exists

  • Return type IList<Ucommerce.EntitiesV2.CampaignItem>

Calling the API

    
    var marketingLibrary = Ucommerce.Infrastructure.ObjectFactory.Instance.Resolve<Ucommerce.Api.IMarketingLibrary>();
    marketingLibrary.GetTargetedCampaignItems();