Loading...
Area: Episerver B2B Commerce

Cart pipelines

Recommended reading 

AddCartLine

Order Pipe Description
100 GetCartLine If the parameter CartLine is not null, sets the result CartLine to the parameter CartLine, otherwise looks through existing CartLines for a matching CartLine for the parameter Product, UnitOfMeasure and CustomProperties and if found, sets the result CartLine to that CartLine.
200 CreateCartLine If the result CartLine is null, creates a new CartLine for the parameter Product, UnitOfMeasure, Notes, CustomProperties and CostCode (if AllowCostCodeEdit is True, if not finds the first active CostCode for the Customer, if there is none, sets CostCode to blank).  Then sets result CartLine to the new CartLine.
300 AddCartLine

If the Cart does not already contain the CartLine:

  • Sets the CartLine Website to the Cart Website if the CartLine Website is not null, if the Cart Website is null, sets it to the current Website.
  • Sets the CartLine TaxCode1 and TaxCode2 to the Cart TaxCode1 and TaxCode2 if they are not set.
  • Sets the CartLine Warehouse to the Cart DefaultWarehouse.
  • Sets the CartLine ShipSite to the CartLine Warehouse ShipSite if it is set.
  • Sets the CartLine Line to the next Line number if the Cart Status is not PunchoutOrderRequest
  • Adds the CartLine to the Cart's CartLines collection.
  • Sets result WasAdded to true.
400 SetRecalculateCartFlags

If result WasAdded is true:

  • Sets Cart RecalculatePromotions to true.
  • Sets Cart ShippingCalculationNeededAsOf to the current date time.
  • Sets Cart RecalculateTax to true.
  • Calls CartPipeline.CalculateHandling on the Cart.
500 SetQtyOrdered

If the parameter QtyOrdered is not null:

  • Determines the quantity to set the CartLine QtyOrdered by checking the CartSettings ReplaceOnAdd, if it's true and the Cart Status is not Requisition, it uses the parameter QtyOrdered, otherwise it uses the parameter QtyOrdered plus the CartLine QtyOrdered.
  • If the CartLine Product has a MinimumOrderQty, adjusts the quantity based on that and the unit of measure and sets result IsQtyAdjusted to true.
  • Applies rounding rules to the quantity and if different than the original quantity sets result IsQtyAdjusted to true.
  • Sets the CartLine QtyOrdered to the final calculated quantity.
600 RemoveCartLine If the final QtyOrdered is zero, calls CartPipeline.RemoveCartLine to remove the CartLine.
700 SetImpersonatedBy If there is an Impersonation Cookie, sets the Cart ImpersonatedByAdminUserProfile.

CalculateHandling

Order Pipe Description
100 CheckIsCalculationNeeded Sets Cart HandlingCharges to zero and then sets result IsCalculationNeeded to true if the Cart Status is not PunchOutOrderRequest and the Cart Website is not null and the Cart Type is Quote or any CartLine Products have IsQuoteRequired set to false.
200 CalculateAmount

If result IsCalculationNeeded is true and ShippingGeneralSettings HandlingCalculation is set to Amount:

  • If all Products in the Cart have a HandlingAmountOverride of zero, sets the Handling Charges to zero.
  • Sums up the HandlingAmountOverride for the Products in the Cart that have one and will multiply that by the QtyOrdered if ShippingGeneralSettings HandlingAmountMultiplyByQtyOrdered is true.
  • Adds the Cart ShipTo State HandlingAmount if there is one.
  • Adds the ShippingGeneralSettings HandlingAmount if there is one.
  • Rounds the final Cart HandlingCharges.
300 CalculatePercent

If result IsCalculationNeeded is true and ShippingGeneralSettings HandlingCalculation is set to Percent:

  • If all Products in the Cart have a HandlingAmountOverride of zero, sets the Handling Charges to zero.
  • Uses the last found non zero HandlingAmountOverride times the Cart sub total with discounts to calculate the override amount.
  • Adds the Cart ShipTo State HandlingAmount (if there is one) times the Cart sub total with discounts.
  • Adds the ShippingGeneralSettings HandlingAmount (if there is one) times the Cart sub total with discounts.
  • Rounds the final Cart HandlingCharges.

CreateGetCartLineResult

Order Pipe Description
100 CreateGetCartLineResult Maps the parameter GetCartResult, CartLine and ProductDto in to the result GetCartLineResult.
200 GetInventory

If InventorySettings AllowBackOrder is true and the parameter CartLine Product is not discontinued or the parameter CartLine Product is not inventory tracked, sets GetCartLineResult QtyLeft to -1 and if RealTime Inventory is enabled, gets the realtime inventory (most likely from cache) and sets the GetCartLineResult ProductDto Availability.

Otherwise, calls the InventoryPipeline GetInventory to get the Availability and sets the GetCartLineResult QtyLeft equal to the QtyOnHand minus the QtyOrdered and the GetCartLineResult HasInsufficientInventory to true if the QtyLeft is less than zero and the Product does not require a quote.

300 MapConfigurationToSectionOptions

If the parameter CartLine has OrderLineConfigurationValues, it maps them in to result GetCartLineResult SectionOptions.

If the parameter CartLine is xml configured, it maps the CartLine ConfigDataSet in to the result GetCartLineResult SectionOptions.

400 CopyCustomPropertiesToResult Copies the CartLine custom properties in to the result GetCartLineResult Properties collection.

GetCartDataSet

Order Pipe Description
100 CreateDataSet Sets result DataSet to a new DataSet named CustomerOrderDataSet.
200 AddBillTo Adds the Cart BillTo as table Customer, BillTo CustomProperties as table CustomerProperty, BillToState as table BillToState and BillToCountry as table BillToCountry to the DataSet.
300 AddShipTo Adds the Cart ShipTo as table ShipTo, ShipTo CustomProperties as table ShipToProperty, ShipToState as table ShipToState and ShipToCountry as table ShipToCountry to the DataSet.
400 AddGiftCardTransactions Adds the Cart GiftCardTransactions as table GiftCardTransaction to the DataSet.
500 AddPromotions Adds the Cart CustomerOrderPromotions as table CustomerOrderPromotion and their corresponding Promotions as table Promotion to the DataSet.
600 AddCreditCardTransactions Adds the Cart CreditCardTransactions as table CreditCardTransaction to the DataSet, if OrderSubmitSettings SubmitAllPaymentInfo is false, this only includes successful transactions with the transaction types S, D, C and V.
700 AddShipVia

Adds the Cart ShipVia as table ShipVia to the DataSet.

800 AddAffiliates Adds the Cart Affiliate as table Affiliate to the DataSet if it is not null.
900 AddDropShip Adds the Cart DropShipCustomer as table DropShip to the DataSet if it is not null.
1000 AddWebsite Adds the Cart Website as table Website to the DataSet if it is not null.
1100 AddUserProfiles Adds the Cart ApprovedByUserProfile, InitiatedByUserProfile, QuoteByUserProfile and PlacedByUserProfile with tables of the same name to the DataSet if they are not null.
1200 AddSalesPerson Adds Cart Salesperson as table Salesperson to the DataSet if it is not null.
1300 AddWarehouse Adds Cart DefaultWarehouse as table Warehouse to the DataSet if it is not null.
1400 AddCurrency Adds Cart Currency as table Currency to the DataSet if it is not null.
1500 AddLanguage Adds Cart Language as table Language to the DataSet if it is not null.
1600 AddCustomerOrder Adds Cart including a column for DefaultWarehouseName and DiscountAmount as table CustomerOrder and Cart CustomProperties as table CustomerOrderProperty to the DataSet.
1700 AddOrderLines Adds Cart CartLines including columns DollarOffOrder, DollarOffShipping, PercentOffOrder, PercentOffShipping, ProductDiscount, PromotionResultName, ProductDiscountPerEach, Warehouse and ErpNumber as table OrderLine, CartLine CustomProperties as table OrderLineProperty, CartLine ConfigurationValues as table OrderLineConfigurationValue, CartLine Product as table Product, CartLine Product CustomProperties as table ProductProperty, CartLine Product Vendor as table Vendor if it's not null and CartLine Warehouse as table Warehouse if it's not null to the DataSet.
1800 AddCustomerOrderTaxes Adds Cart CustomerOrderTaxes as table CustomerOrderTaxProperty to the DataSet.

RemoveCartLine

Order Pipe Description
100 RemoveCartLine If the parameter Cart contains the parameter CartLine, deletes the CustomProperties for that CartLine, deletes the CustomerOrderPromotions for that CartLine and then deletes the CartLine, removes it from the Cart CartLines collection, and sets result WasRemoved to true.
200 RenumberCartLines If parameter RenumberLines is true and there are CartLines, calls UnitOfWork.Save() to save the current state so there aren't problems renumbering.  Sets all CartLine numbers to the current max line number plus one, plus their current line number and calls UnitOfWork.Save(), then goes through and renumbers the lines in order from 1 and calls UnitOfWork.Save().
300 SetRecalculateCartFlags

If result WasRemoved is true:

  • Sets Cart RecalculatePromotions to true.
  • Sets Cart ShippingCalculationNeededAsOf to the current date time.
  • Sets Cart RecalculateTax to true.
  • Calls CartPipeline.CalculateHandling on the Cart.
400 SetImpersonatedBy If there is an Impersonation Cookie, sets the Cart ImpersonatedByAdminUserProfile.

SetBillTo

Order Pipe Description
100 SetBillTo

If the parameter BillTo is not null:

  • Sets Cart Customer to BillTo.
  • Sets Cart CustomerId to BillTo.Id.
  • Sets Cart CustomerNumber to BillTo.CustomerNumber.
  • Sets Cart TermsCode to BillTo.TermsCode.
  • Sets Cart BTCompanyName to BIllTo.CompanyName.
  • Sets Cart BTFirstName to BillTo.FirstName.
  • Sets Cart BTMiddleName to BillTo.MiddleName.
  • Sets Cart BTLastName to BillTo.LastName.
  • Sets Cart BTPhone to BillTo.Phone.
  • Sets Cart BTAddress1 to BillTo.Address1.
  • Sets Cart BTAddress2 to BillTo.Address2.
  • Sets Cart BTAddress3 to BillTo.Address3.
  • Sets Cart BTAddress4 to BillTo.Address4.
  • Sets Cart BTCity to BillTo.City.
  • Sets Cart BTState to BillTo.State.Name.
  • Sets Cart BTPostalCode to BillTo.PostalCode.
  • Sets Cart BTCountry to BillTo.Country.Name
  • Sets Cart BTEmail to BillTo.Email.
200 SetShipTo If the parameter BillTo is not null and the parameter ShipTo is AbandonedCart, calls the CartPipeline.SetShipTo passing in the BillTo as the ShipTo.

SetShipTo

Order Pipe Description
100 CheckIsShipToChanged

If the parameter ShipTo is not null, sets result IsShipToChanged to true if:

  • The Cart ShipToId equals Guid.Empty.
  • The Cart ShipTo does not equal the parameter ShipTo.
  • The Cart STState or STCountry do not equal the parameter ShipTo State and Country.
  • The Cart STCity does not equal the parameter ShipTo City.
  • The Cart STPostalCode does not equal the parameter ShipTo PostalCode.
  • The Cart CustomerSequence does not equal the parameter ShipTo CustomerSequence.
  • The Cart STCompanyName does not equal the parameter ShipTo CompanyName.
  • The Cart STFirstName does not equal the parameter ShipTo FirstName.
  • The Cart STLastName does not equal the parameter ShipTo LastName.
  • The Cart STAddress1 does not equal the parameter ShipTo Address1.
  • The Cart STAddress2 does not equal the parameter ShipTo Address2.
200 SetShipTo

If the parameter ShipTo is not null:

  • Sets Cart ShipTo to ShipTo. 
  • Sets Cart ShipToId to ShipTo.Id.
  • Sets Cart CustomerSequence to ShipTo.CustomerSequence.
  • Sets Cart DefaultWarhouse to ShipTo.DefaultWarhouse if it's not null, otherwise, ShipTo.Parent.DefaultWarehouse if it's not null, otherwise, the system default Warehouse.
  • Sets Cart SalespersonId to ShipTo.PrimarySalesPersonId if it's not null, otherwise, the Cart BillTo PrimarySalespersonId.
  • Sets Cart ShipEarly to ShipTo.ShipEarly.
  • Sets Cart ShipPartial to ShipTo.ShipPartial.
  • Sets Cart TaxCode1 to ShipTo.TaxCode1.
  • Sets Cart TaxCode2 to ShipTo.TaxCode2.
  • Sets Cart STCompanyName to ShipTo.CompanyName.
  • Sets Cart STFirstName to ShipTo.FirstName.
  • Sets Cart STMiddleName to ShipTo.MiddleName.
  • Sets Cart STLastName to ShipTo.LastName.
  • Sets Cart STPhone to ShipTo.Phone.
  • Sets Cart STAddress1 to ShipTo.Address1.
  • Sets Cart STAddress2 to ShipTo.Address2.
  • Sets Cart STAddress3 to ShipTo.Address3.
  • Sets Cart STAddress4 to ShipTo.Address4.
  • Sets Cart STCity to ShipTo.City.
  • Sets Cart STState to ShipTo.State.Name.
  • Sets Cart STPostalCode to ShipTo.PostalCode.
  • Sets Cart STCountry to ShipTo.Country.Name
  • Sets Cart STEmail to ShipTo.Email.
300 CalculateHandling If the parameter ShipTo is not null and the Cart Status is Cart, calls CartPipeline.CalculateHandling.
400 SetRecalculateCartFlags

If the parameter ShipTo is not null and result IsShipToChanged is true:

  • Sets Cart RecalculatePromotions to true.
  • Sets Cart ShippingCalculationNeededAsOf to the current date time.
  • Sets Cart RecalculateTax to true.
Do you find this information helpful? Please log in to provide feedback.

Last updated: Dec 11, 2020

Recommended reading