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 BasketController, 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.

Read 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 code snippet below. You need to collect the orderLineId and the Quantity entered from the basket table.

 

$uCommerce.updateLineItem(re
     {
          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