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

In the POST method in your MasterClassBasketController, update each line item with either the new quantity or remove it if the user clicks the remove button. 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 the codesnippet below. 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