Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers


Add To Basket

The AddToBasket method is used for adding products to the current customers basket.


    UCommerce.Api.TransactionLibrary.AddToBasket(1, "LBAS");


Parameter Type Details
quantity int The quantity of the product in the basket.
sku string The product SKU, this is how you specify which product from the catalog you want to add.
variantSku string Optional. The variant SKU, if you want to add a specific variant of the product, to the basket.
addToExistingLine bool Optional. If set to true, the quantity is updated if the same product is already added to the basket. Otherwise a new orderline is created.
executeBasketPipeline bool Optional. If set to true, the basket pipeline will be executed, which will trigger all the basket pipeline tasks in the Basket.config configuration file.
catalogId int Optional. In which product catalog the product to be added is found.

Execute Basket Pipeline

The ExecuteBasketPipeline method is used for executing the basket pipeline, and all the basket pipeline tasks defined in Pipelines/Basket.config

The pipeline tasks are responsible for things like calculating order totals, and applying discounts.


    // Executing the basket pipeline after creating a new payment
    UCommerce.Api.TransactionLibrary.CreatePayment(newPaymentMethodId, requestPayment: false);

Get Basket

The GetBasket method is used for retrieving the basket for the current customer.

GetBasket throws an ArgumentException if no basket exists.


    // Or create a new basket if no basket exists


Parameter Type Details
create bool Optional. If set to true it will create a new basket, if one does not already exist.

Has Basket

The HasBasket method is used for determining if the current customer has an active basket.


    if (UCommerce.Api.TransactionLibrary.HasBasket()) {
        var basket = UCommerce.Api.TransactionLibrary.GetBasket();

Update Line Item

The UpdateLineItem method is used for updating the quantity of a specific order line item.


    UCommerce.Api.TransactionLibrary.UpdateLineItem(1, 2);


Parameter Type Details
orderLineId int The id of the order line to update.
newQuantity int The new quantity of the order line.