HomeGuides
Submit Documentation FeedbackJoin Developer CommunityLog In

Cart pipelines

This topic provides an overview of Cart pipelines.

AddCartLine

OrderPipeDescription
100GetCartLineIf 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.
200CreateCartLineIf 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.
300AddCartLineIf 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.
400SetRecalculateCartFlagsIf 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.
500SetQtyOrderedIf 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.
600RemoveCartLineIf the final QtyOrdered is zero, calls CartPipeline.RemoveCartLine to remove the CartLine.
700SetImpersonatedByIf there is an Impersonation Cookie, sets the Cart ImpersonatedByAdminUserProfile.

CalculateHandling

OrderPipeDescription
100CheckIsCalculationNeededSets 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.
200CalculateAmountIf 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.
300CalculatePercentIf 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

OrderPipeDescription
100CreateGetCartLineResultMaps the parameter GetCartResult, CartLine and ProductDto in to the result GetCartLineResult.
200GetInventoryIf 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.
300MapConfigurationToSectionOptionsIf 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.
400CopyCustomPropertiesToResultCopies the CartLine custom properties in to the result GetCartLineResult Properties collection.

GetCartDataSet

OrderPipeDescription
100CreateDataSetSets result DataSet to a new DataSet named CustomerOrderDataSet.
200AddBillToAdds the Cart BillTo as table Customer, BillTo CustomProperties as table CustomerProperty, BillToState as table BillToState and BillToCountry as table BillToCountry to the DataSet.
300AddShipToAdds the Cart ShipTo as table ShipTo, ShipTo CustomProperties as table ShipToProperty, ShipToState as table ShipToState and ShipToCountry as table ShipToCountry to the DataSet.
400AddGiftCardTransactionsAdds the Cart GiftCardTransactions as table GiftCardTransaction to the DataSet.
500AddPromotionsAdds the Cart CustomerOrderPromotions as table CustomerOrderPromotion and their corresponding Promotions as table Promotion to the DataSet.
600AddCreditCardTransactionsAdds 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.
700AddShipViaAdds the Cart ShipVia as table ShipVia to the DataSet.
800AddAffiliatesAdds the Cart Affiliate as table Affiliate to the DataSet if it is not null.
900AddDropShipAdds the Cart DropShipCustomer as table DropShip to the DataSet if it is not null.
1000AddWebsiteAdds the Cart Website as table Website to the DataSet if it is not null.
1100AddUserProfilesAdds the Cart ApprovedByUserProfile, InitiatedByUserProfile, QuoteByUserProfile and PlacedByUserProfile with tables of the same name to the DataSet if they are not null.
1200AddSalesPersonAdds Cart Salesperson as table Salesperson to the DataSet if it is not null.
1300AddWarehouseAdds Cart DefaultWarehouse as table Warehouse to the DataSet if it is not null.
1400AddCurrencyAdds Cart Currency as table Currency to the DataSet if it is not null.
1500AddLanguageAdds Cart Language as table Language to the DataSet if it is not null.
1600AddCustomerOrderAdds Cart including a column for DefaultWarehouseName and DiscountAmount as table CustomerOrder and Cart CustomProperties as table CustomerOrderProperty to the DataSet.
1700AddOrderLinesAdds 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.
1800AddCustomerOrderTaxesAdds Cart CustomerOrderTaxes as table CustomerOrderTaxProperty to the DataSet.

RemoveCartLine

OrderPipeDescription
100RemoveCartLineIf 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.
200RenumberCartLinesIf 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().
300SetRecalculateCartFlagsIf 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.
400SetImpersonatedByIf there is an Impersonation Cookie, sets the Cart ImpersonatedByAdminUserProfile.

SetBillTo

OrderPipeDescription
100SetBillToIf 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.
200SetShipToIf the parameter BillTo is not null and the parameter ShipTo is AbandonedCart, calls the CartPipeline.SetShipTo passing in the BillTo as the ShipTo.

SetShipTo

OrderPipeDescription
100CheckIsShipToChangedIf 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.

200SetShipToIf 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.

300CalculateHandlingIf the parameter ShipTo is not null and the Cart Status is Cart, calls CartPipeline.CalculateHandling.
400SetRecalculateCartFlagsIf 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.

📘

PunchOut references

PunchOut2Go rebranded to TradeCentric in June 2022. Code may still refer to PunchOut.


What’s Next
Did this page help you?