Checkout - Update Basket

Learn to execute the basket pipeline so the orders are kept up-to-date.

 


Relevant APIs

UCommerce.Api
TransactionLibrary.UpdateLineItem(orderLineId, quantity)
TransactionLibrary.ExecuteBasketPipeline()
MarketingLibrary.AddVoucherCode(voucherCode)

Hands-on

When “UpdateBasketButton_OnClick” is called on Basket.aspx.cs, update each line item with either the new quantity. If the user clicks Remove, remove the order line in “RemoveOrderLineButton_OnClick”. Execute the basket pipeline so the order is kept up-to-date.

You can read more about pipelines here:
http://docs.ucommerce.net/ucommerce/v6.8/getting-started/transaction-foundation/pipelines-explained.html


Bonus

Continue the javascript gig from before by updating the basket using a code snippet similar to the one below. You need to collect the orderLineId and the Quantity entered from the basket table.

$uCommerce.updateLineItem(
{
orderLineId: $(this).data("lineitemid"),
newQuantity: $(this).val()
},
function() {},
function() {}
)

 

{{lineitem.ProductName}}

{{lineitem.VariantName}} - {{lineitem.Quantity}} x {{lineitem.FormattedPrice}} {{lineitem.FormattedPrice}}

Your cart is empty ;(
Total {{basket.FormattedProductsTotal}}
Checkout