Only this pageAll pages
Powered by GitBook
1 of 20

Commerce Packages

Loading...

Commerce Products

Cart

Loading...

Loading...

Loading...

Checkout

Loading...

Loading...

Loading...

Loading...

Loading...

Deploy

Loading...

Loading...

Loading...

Product Feeds

Loading...

Loading...

Loading...

Installation

Detailed instructions on how to install and configure Cart into your Umbraco Commerce implementation.

The Cart package can be installed directly into your project's code base using NuGet packages.

NuGet Package Installation

To install the Umbraco Commerce Cart package via NuGet run the following command directly in the NuGet Manager Console window in Visual Studio:

PM> Install-Package Umbraco.Commerce.Cart

Client Assets Installation

Once installed, add the following CSS to your layout templates head section:

<link href="/App_Plugins/UmbracoCommerceCart/umbraco-commerce-cart.css" rel="stylesheet">

Add following JavaScript before the closing body tag:

<script src="/App_Plugins/UmbracoCommerceCart/umbraco-commerce-cart.js" defer></script>

Once installed, head to the Configuration section to configure the Cart for your solution.

Overview

This is the documentation for the Cart package for Umbraco Commerce.

Umbraco Commerce Cart is a free and open-source add-on package for Umbraco Commerce. It provides a low-code solution for creating an instant shopping cart in your Umbraco Commerce stores.

Umbraco Commerce Cart allows you to set up your shopping cart with minimal development costs.

In this section, you will learn the key steps necessary to get started with the Cart package for Umbraco Commerce.

It is assumed that you already have an Umbraco website configured, Umbraco Commerce installed and a store set up. If you are not at this stage yet, please read the to learn how to get started.

Useful links

As well as the content in these documents, here are a few useful links to learn more about the Umbraco Commerce Cart package.

Packages for Umbraco Commerce

Find detailed documentation for each of the official packages available for extending your Umbraco Commerce installation.

Below is an overview of the different add-ons that you can install into your Umbraco Commerce implementation. All add-ons are meant to extend the features and functionality already available in the core product.

Using These Docs

These docs are aimed at developers and users who have at least a basic understanding of , as well as Umbraco backoffice principles.

As there is no code involved with using Umbraco Commerce Deploy, the docs are purely a series of articles covering how to install and configure Deploy.

core Umbraco Commerce documentation
Umbraco Commerce Cart source code
Umbraco Commerce Cart issue tracker
A look at the Umbraco Commerce Cart UI
Umbraco

Cart

Use this package to add a drop in cart solution to your Umbraco Commerce implementation.

Checkout

Use this package to add additional functionality to the checkout flow for your Umbraco Commerce implementation.

Deploy

This package is used to enable the use of Umbraco Deploy with your Umbraco Commerce implementation.

Product feeds

This plugin is a XML feed generator plugin which extracts product data from Umbraco node and generate structured XML feed.

Deploying Changes

Learn more about the advantages of using the Umbraco Commerce Deploy package with Umbraco Commerce.

After installing Umbraco Commerce Deploy, it will automatically serialize any changes made in the Umbraco Commerce settings section to disk. They will be added to the data\revision folder alongside Umbraco's own serialized content.

These files should be committed to your repository. Umbraco Deploy will then monitor these files and automatically deploy changes between environments for you.

Learn more about how the deployment process works in the Umbraco Deploy documentation.

Ignoring Settings

Some entities in Umbraco Commerce accept configuration settings such as Payment Methods, Shipping Methods, and Tax Calculation Methods. These settings can be environment-specific, and therefore, you may not want to deploy them between environments. To prevent this from happening, you can add the following configuration options to your appsettings.json file.

appsettings.json
{
  ...
  "Umbraco": {
    "Commerce": {
      "Deploy": {
        "PaymentMethods": {
          "IgnoreSettings": [ "liveApiKey", "testMode" ]
        },
        "ShippingMethods": {
          "IgnoreSettings": [ "liveApiKey", "testMode" ]
        },
        "TaxCalculationMethods": {
          "IgnoreSettings": [ "liveApiKey", "testMode" ]
        }
      }
    }
  }
  ...
}

For each supported entity type, you can supply an IgnoreSettings option, which contains an array of aliases of the settings options to be ignored.

Overview

This is the documentation for the Product Feed package for Umbraco Commerce.

After building up your commerce website, you can expand your product reach and show your products to a larger audience with product feeds. Umbraco Commerce Product Feed is a free and open-source add-on for Umbraco Commerce that helps you generate the XML files that are used in services like Google Merchant Center.

Umbraco Commerce Product Feeds package is an XML feed generator plugin that simplifies the creation of structured XML files. It automatically extracts product data from Umbraco nodes, organizes it according to standards and also allows you to add more information to the feed.

Current supported feed template:

  • Google Merchant Center feed template.

In this section, we will guide you through the key steps necessary to get you started with the Product Feeds package for Umbraco Commerce.

It is assumed that before we begin you already have an Umbraco website configured and Umbraco Commerce installed and a store set up. If you are not at this stage yet, please read the core Umbraco Commerce documentation to learn how to get started.

Useful links

  • Umbraco Commerce Product Feed source code

  • Umbraco Commerce Product Feed issue tracker

Configure Umbraco

Learn how to configure Umbraco in order to start using the Checkout package.

After installing the Checkout package, a series of content nodes will be created for you on your site. These will control the checkout flow.

On the root of these nodes, you can configure a series of options to customize the checkout flow to your needs.

Step 1: Configuring the Checkout flow

Name
Description

In addition to these root node settings, each checkout step page also has a number of configurable options:

Name
Description

Linking to the Checkout

With the checkout setup and configured the final step is to configure your cart page to link through to the checkout flow. How you do this is up to you:

  • Link to the URL /checkout or

  • Use a Content Picker to select the checkout node to link to.

Installation

Detailed instructions on how to install and configure Checkout into your Umbraco Commerce implementation.

The Checkout package can be installed directly into your project's code base using NuGet packages.

NuGet Package Installation

To install the Umbraco Commerce Checkout package via NuGet run the following command directly in the NuGet Manager Console window in Visual Studio:

Alternatively, you can also find and install the NuGet package via the NuGet Package Manager.

Content Installation

When the Checkout package is installed, all relevant database configurations automatically occur via Umbraco Migrations. There are a series of content creation steps that need to be triggered manually as these types of migrations are not supported by Umbraco.

To install the relevant Checkout content follow these steps:

  1. Access the Umbraco CMS backoffice.

  2. Navigate to the Settings section.

  3. Locate the Checkout Dashboard.

  1. Click the Install button.

  2. Select your site's root node which is configured with a Umbraco Commerce store.

  3. Click Install.

During this install, Umbraco Commerce checkout will perform the following tasks:

Upgrading

Before upgrading, it is always advisable to take a complete backup of your site/database.

The Checkout package uses a combination of database migrations and a manual install dashboard for both installs and upgrades. Upgrading is generally a case of installing the latest version over the existing package and running through the installation steps.

Installation

Detailed instructions on how to install and configure Product Feeds into your Umbraco Commerce implementation.

The Product Feeds package can be installed directly into your project's code base using NuGet packages.

Getting started

Below you can find some steps on installing the package using NuGet and getting started with implementing the Product Feeds into your Umbraco Commerce store.

  1. Install the package from

  2. Locate where you IUmbracoBuilder.AddUmbracoCommerce() and add a call to IUmbracoCommerceBuilder.AddCommerceProductFeeds() to add this plugin to your website.

  3. Open your store's setting page in the backoffice.

  4. Click on Product Feed section.

  1. Click on Create Product Feed button and fill in the feed settings. Mandatory fields are marked with a red asterisk (*). You can add more product data by adding new mappings in Property And Node Mapping section.

  1. After saving the feed setting, a link to access the feed will show up under Feed URL Segment field and at the bottom of the page.

Google Merchant Center Feed sample:

Upgrading

Even though the package modifies only the umbracoCommerceProductFeedSetting table, it is always advisable to take a complete backup of your site/database before upgrading.

The Product Feeds package uses a database migration for both installs and upgrades. Upgrading is generally a case of installing the latest version via NuGet over the existing package and restarting the website.

Checkout Screenshots

Take a closer look at how the default checkout flow looks when installing the Checkout package for Umbraco Commerce.

Check out the screenshots below to see what you get with Umbraco Commerce Checkout straight out of the box.

Overview

This is the documentation for the Checkout package for Umbraco Commerce.

Umbraco Commerce Checkout is a free and open-source add-on package for Umbraco Commerce. It provides a no-code solution for creating an instant checkout flow in your Umbraco Commerce stores.

Umbraco Commerce Checkout allows you to set up your checkout flow with minimal configuration.

In this section, we will guide you through the key steps necessary to get you started with the Checkout package for Umbraco Commerce.

It is assumed that before we begin that you already have an Umbraco website configured and Umbraco Commerce installed and a store set up. If you are not at this stage yet, please read the to learn how to get started.

Useful links

As well as the content in these docs, here are a few useful links to learn more about the Umbraco Commerce Checkout package itself.

Store Logo

A link to a media item to use as the store logo. If one is not selected, then the store name will be displayed instead.

Store Address

The official address of the store. This will be displayed in the footer of all email communications.

Theme Color

The color theme to use for the checkout design.

Collect Shipping Info

A checkbox to set whether to collect shipping info or not. If deselected, all shipping info-related fields/steps will be removed from the checkout flow

Order Line Property Aliases

A comma-separated list of order line property aliases to display in the order summary.

Checkout Back Page

The page to go back to when backing out of the checkout flow.

Terms and Conditions Page

Defines which page on the site contains the terms and conditions of the store.

Privacy Policy Page

The page on the site containing the privacy policy.

Hide from Navigation

Checkbox to hide the checkout page from the site's main navigation.

Short Step Name

A short name for this step to display in the checkout navigation.

Step Type

The checkout step to display for this step of the checkout flow.

Overview of some of the different configuration options for customizing the Checkout flow.
PM> Install-Package Umbraco.Commerce.Checkout
Installing Umbraco Commerce Checkout via the NuGet Package Manager.
The Checkout Dashboard in the Settings section of the Umbraco backoffice.
The dialog that appears when installing content through the Checkout dashboard.
 umbracoBuilder.AddUmbracoCommerce(ucBuilder => {
     ucBuilder.AddCommerceProductFeeds(); // add this line
 }
NuGet
register the dependencies
product feed list page
feed setting page
open feed link
google merchant center feed
Umbraco Commerce Checkout Settings
Umbraco Commerce Checkout Settings
Umbraco Commerce Checkout Customer Details
Shipping methods
Payment methods
Order review
Order confirmation
Umbraco Commerce Checkout Order Email
core Umbraco Commerce documentation
Umbraco Commerce Checkout source code
Umbraco Commerce Checkout issue tracker
A look at how the default Checkout flow appear on the frontend.

Overview

This is the documentation for the Deploy package for Umbraco Commerce.

Umbraco Commerce Deploy is a free and open-source add-on package for Umbraco Commerce. It provides Umbraco Deploy and Umbraco Cloud support, allowing the transfer of Umbraco Commerce settings between environments.

In this section, we will guide you through the key steps necessary to get you started with the Deploy package for Umbraco Commerce.

It is assumed that you already have one of the following setups:

  • A Umbraco Cloud site with Umbraco Commerce installed and configured.

  • A Umbraco CMS site configured with Umbraco Deploy and Umbraco Commerce installed and configured.

If you are not at this stage yet, please read the core Umbraco Commerce documentation to learn how to get started.

Useful links

As well as the content in these docs, the following links may prove useful when using this package:

  • Umbraco Commerce Deploy source code

  • Umbraco Commerce Deploy issue tracker

Customize Checkout

This documentation shows how to customize the Checkout package for Umbraco Commerce.

It is assumed that you already have an Umbraco website configured Umbraco Commerce installed and a store set up. If you are not at this stage yet, please read the core Umbraco Commerce documentation to learn how to get started.

Umbraco Commerce Checkout is a free and open-source add-on package for Umbraco Commerce. It is possible to amend the default behavior to customize the checkout to your needs.

Setup

To allow customization you must first 'override' the existing files for the step required to be modified.

To do this follow these steps:

  1. Copy the equivalent files and partials.

  2. Add them to Views/UmbracoCommerceCheckout in your project directory. It might be necessary to create the folder first.

  3. Make a small text change to one of the Views to verify that the files are in use.

  4. Verify that the changes are carried out and displayed correctly.

You are now ready to start customizing the Checkout page to fit the design of your website.

Useful links

Here are a few useful links to learn more about the Umbraco Commerce Checkout package:

  • Umbraco Commerce Checkout source code

  • Umbraco Commerce Checkout issue tracker

Installation

Detailed instructions on how to install and configure Deploy into your Umbraco Commerce implementation.

The Umbraco Commerce Deploy package can be installed directly into your project's code base using our NuGet packages.

NuGet Package Installation

To install the Umbraco Commerce Deploy package via NuGet run the following command directly in the NuGet Manager Console window using Visual Studio:

PM> Install-Package Umbraco.Commerce.Deploy

Alternatively, you can also find and install the NuGet package via the NuGet Package Manager.

Installing Umbraco Commerce Deploy via the NuGet Package Manager

Upgrading

Umbraco Commerce Deploy does not consist of any UI files or database changes. It is generally ok to install the upgrade on top of a previous install.

Configuration

Learn how to configure the Umbraco Commerce Cart package.

The Cart package is configured using a JavaScript, CSS, and data attributes-based API.

Initialization

Before adding items to a cart, it is required that the Cart package is initialized with some default settings. This is done using the UCC.init global function which should be executed after the umbraco-commerce-cart.js file is loaded.

<script src="/App_Plugins/UmbracoCommerceCart/umbraco-commerce-cart.js" defer></script>
<script>
    window.addEventListener('DOMContentLoaded', function() {
        UCC.init({
            store: 'blendid',
            checkoutUrl: '/checkout',
            showPricesIncludingTax: true
        });
    });
</script>

The core initialization settings are shown in the table below.

Key
Description

store

The ID or alias of the store the cart should be associated with.

checkoutUrl

The URL of the checkout page the cart should redirect to on checkout.

showPricesIncludingTax

Define whether to show prices inclusive or exclusive of sales tax. Defaults to false.

Calling the init method will also automatically bind any UI elements configured using the following APIs.

UI Elements

Add to Cart Buttons

With Umbraco Commerce Cart, products that can be added to a cart are defined by adding attributes to HTML elements on your site. Most likely this will be a "buy" <button> element, however, any HTML element can become an add-to-cart component.

The first step when defining an add-to-cart component is to add the ucc-add-to-cart class to the element. This informs Umbraco Commerce Cart that it should react to that element's click event.

<button class="ucc-add-to-cart"
  data-ucc-product-reference="828c0bfe-c0e7-4891-a36b-187b658357fc">
  Add to cart
</button>

Along with the ucc-add-to-cart class, a series of data attributes provides information about the product being added to the cart. At a minimum, a data-ucc-product-reference is required, but the following table outlines all the available configuration options.

Key
Description

data-ucc-product-reference

The unique reference for the product being added. This is usually the Key of the product Umbraco node.

data-ucc-product-variant-reference

The unique reference for a variant of the primary product being added. This is usually either a child variant node Key or the Key of a complex variant item from the Variants property editor.

data-ucc-quantity

The amount of the given product to be added.

data-ucc-property1-key

The key of a property to set on the added order line.

data-ucc-property1-value

The value of a property to set on the added order line.

data-ucc-bundle-reference

A unique reference to use to mark this item as a bundle.

data-ucc-bundle-item1-product-reference

The unique reference of a product to add as a bundle item.

data-ucc-bundle-item1-product-variant-reference

The unique reference of a product variant to add as a bundle item.

data-ucc-bundle-item1-quantity

The amount of the given product to add as a bundle item.

data-ucc-bundle-item1-property1-key

The key of a property to set on the added bundle item.

data-ucc-bundle-item1-property1-value

The value of a property to set on the added bundle item.

Some attributes end with a number. This signifies that the attribute defines a collection and so multiple attributes can be defined with each distinct combination incrementing the number by 1. It is important that these attributes start from 1 and must be sequential without gaps.

With an add-to-cart button defined, clicking on the button will automatically add the product and open the cart for display.

Shopping cart modal.

Open Cart Button

While the cart will open automatically when an item is added, you can also enable the customers to open their carts manually. To do this, add a ucc-cart class to a link or button element. The Umbraco Commerce Cart will then automatically bind a click event handler to trigger opening the cart.

<a href="#" class="ucc-cart">Cart</a>

Cart Count Label

Another common feature on commerce sites is the ability to display the total number of items in the current cart. To do this, define an HTML element with a ucc-cart-count class applied. Umbraco Commerce Cart will then automatically update its text value whenever the cart changes.

<a href="#" class="ucc-cart">Cart (<span class="ucc-cart-count">0</span>)</a>

Commands

As well as the automatic API defined above, it is possible to trigger Umbraco Commerce Cart commands manually via a number of JavaScript functions.

// Open the cart
UCC.openCart();

// Close the cart
UCC.closeCart();

// Re-bind UI API elements
UCC.bind();

// Update the store configuration
UCC.setStore('brewed');

// Update the checkout URL
UCC.setCheckoutUrl('/new-checkout');

// Set whether to display prices inclusive or exclusive of sales tax
UCC.showPricesIncludingTax(true);

// Show a property in the cart
UCC.showProperty('myProp');

// Change the language of the cart UI
UCC.setLang('dk');

// Add or replace a localization dictionary
UCC.addLocale('en', {
   key: 'value',
   ...
});

// Set the error handler
UCC.setOnError(msg => {
    console.log(msg);
});

Localization

The cart UI supports being translated into any language. Out of the box, it comes with a default English translation, but additional locales can be configured.

Localization is controlled via the lang attribute in the <html> tag of your site.

<!DOCTYPE html>
<html lang="fr">
    <head>
        <title></title>
    </head>
    <body></body>
</html>

In the above example, Umbraco Commerce Cart will look for a French locale. If a given locale can't be found, then it will default back to English.

Additional locales can be added either via the UCC.init method or by calling the UCC.addLocale command.

// Init command example
UCC.init({
    store: 'blendid',
    checkoutUrl: '/checkout',
    locales: {
        fr: {
            cart_title: 'Mon Panier',
            close_cart: 'Fermer le panier (ESC)',
            checkout: 'Vérifier',
            taxes: 'Impôts',
            subtotal: 'Total',
            total: 'Total',
            shipping_and_discounts_message: "Calculez les frais d'expédition et appliquez des remises lors du paiement",
            remove: 'Retirer',
            cart_empty: 'Votre panier est vide',
        }
    }
});

// Add locale command example
UCC.addLocale('fr', {
    cart_title: 'Mon Panier',
    close_cart: 'Fermer le panier (ESC)',
    checkout: 'Vérifier',
    taxes: 'Impôts',
    subtotal: 'Total',
    total: 'Total',
    shipping_and_discounts_message: "Calculez les frais d'expédition et appliquez des remises lors du paiement",
    remove: 'Retirer',
    cart_empty: 'Votre panier est vide',
})

The default English locale has the following values and defines the required keys for a locale.

{
    cart_title: 'My Cart',
    close_cart: 'Close Cart (ESC)',
    checkout: 'Checkout',
    taxes: 'Taxes',
    subtotal: 'Subtotal',
    total: 'Total',
    shipping_and_discounts_message: 'Calculate shipping and apply discounts during checkout',
    remove: 'Remove',
    cart_empty: 'Your cart is empty',
}

To override a locale you can re-add it by reusing the same language key.

// Init command example
UCC.init({
    store: 'blendid',
    checkoutUrl: '/checkout',
    locales: {
        en: {
            ...UCC.defaultLocales.en, // Clone the default locale
            remove: 'Remove item',    // Update the `remove` key value
        }
    }
});

// Add Locale command example
UCC.addLocale('en', {
    ...UCC.defaultLocales.en, // Clone the default locale
    remove: 'Remove item',    // Update the `remove` key value
})

Displaying Properties

If you capture any custom properties, you may want to display them within the cart. Displaying properties is achieved in two steps.

First, you define the property keys you wish to display either via the UCC.init command, or the UCC.showProperty command.

// Init command example
UCC.init({
    store: 'blendid',
    checkoutUrl: '/checkout',
    properties: [ 'message' ]
});

// Show property command example
UCC.showProperty('message');

Next, you define a localization key to use as a label for each property.

// Init command example
UCC.init({
    store: 'blendid',
    checkoutUrl: '/checkout',
    properties: [ 'message' ],
    locales: {
        en: {
            ...UCC.defaultLocales.en,    // Clone the default locale
            property_message: 'Message', // Provide a key translation prefixed with `property_`
        }
    }
});

// Show property + add locale command example
UCC.showProperty('message');
UCC.addLocale('en', {
    ...UCC.defaultLocales.en,    // Clone the default locale
    property_message: 'Message', // Provide a key translation prefixed with `property_`
})

Now, when the cart is displayed, the defined properties will be displayed using the localization value as their label.

Example property

Theming

To allow customization of the cart UI, CSS variables are used to allow overriding of the default styles.

The following details the default values, and the available keys to override.

:root {
    
    /* Colors */
    --ucc-primary-color: #155dfc;
    --ucc-primary-color-light: #51a2ff;
    --ucc-primary-color-dark: #193cb8;
    --ucc-danger-text-color: #9f0712;
    --ucc-danger-background-color: #ffc9c9;

    /* Font */
    --ucc-font-family: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif;
    
    /* Text */
    --ucc-text-color: #364153;
    --ucc-text-color-light: #99a1af;
    --ucc-text-color-lighter: #c1c7d0;
    --ucc-text-color-dark: #101828;
    --ucc-text-lg: 20px;
    --ucc-text-md: 16px;
    --ucc-text-sm: 14px;
    
    /* Borders */
    --ucc-border-color: #ddd;
    --ucc-border-radius: 5px;
    
    /* Components */
    --ucc-button-background-color: var(--ucc-primary-color);
    --ucc-button-text-color: #fff;
    --ucc-button-background-color-hover: var(--ucc-primary-color-dark);
    --ucc-button-text-color-hover: #fff;
    --ucc-button-background-color-disabled: #d1d5dc;
    --ucc-button-text-color-disabled: #fff;
    --ucc-modal-width: 550px;
    --ucc-modal-background-color: #fff;
    --ucc-modal-overlay-color: rgba(0, 0, 0, 0.5);
}

Styles can be overridden by including a stylesheet after the Umbraco Commerce Cart stylesheet, replacing the desired keys.

<link href="/App_Plugins/UmbracoCommerceCart/umbraco-commerce-cart.css" rel="stylesheet">
<style>
    :root {
        --ucc-button-background-color: #4FD1C5;
        --ucc-button-background-color-hover: #38B2AC;
    }
</style>

Error Handling

By default, Umbraco Commerce Cart will log any request errors to the console. If you would like to display errors to your users or handle them differently you can provide an error handler function.

// Init command example
UCC.init({
    store: 'blendid',
    checkoutUrl: '/checkout',
    onError: (msg) => console.log(msg)
});

// Set on error command example
UCC.setOnError(msg => console.log(msg));

Extending the plugin

Learn how to extend the plugin by adding a custom property value extractor.

In this article, you can find an example of extending the plugin by adding a custom property value extractor.

Add a custom property value extractor

When a default property value extractor does not suit your need, you can create your own extractor to extract the property value yourself.

For example, when a product's stock value is 0, Google Merchant Feed desired value is out_of_stock. In that case, we have DefaultGoogleAvailabilityValueExtractor.cs to do the conversion from 0 to out_of_stock.

You can often create a new implementation of ISingleValuePropertyExtractor or rarely IMultipleValuePropertyExtractor.

This plugin uses Collection Builder pattern which is commonly used in Umbraco. You can use these two extension methods during application initialization to add your value extractors.

// IUmbracoBuilder builder;
builder.SingleValuePropertyExtractors()
    .Append<DefaultSingleValuePropertyExtractor>()
    .Append<DefaultGoogleAvailabilityValueExtractor>()
    .Append<DefaultMediaPickerPropertyValueExtractor>();

builder.MultipleValuePropertyExtractors()
    .Append<DefaultMultipleMediaPickerPropertyValueExtractor>();

Afterwards, your extractor name should show up in the dropdown under Property And Node Mapping section.

property value extractor dropdown