Umbraco Commerce
CMSCloudHeartcoreDXP
15.latest
15.latest
  • Umbraco Commerce Documentation
  • Release Notes
    • v15.1.0-Rc
    • v15.0.0-Rc
  • Commerce Products
    • Commerce Packages
    • Commerce Payment Providers
    • Commerce Shipping Providers
  • Getting Started
    • Requirements
    • Installation
    • Licensing
    • Configuration
    • User Interface
  • Upgrading
    • Upgrading Umbraco Commerce
    • Version Specific Upgrade Notes
    • Migrate from Vendr to Umbraco Commerce
      • Migrate Umbraco Commerce Checkout
      • Migrate custom Payment Providers
  • Tutorials
    • Build a Store in Umbraco using Umbraco Commerce
      • Installation
      • Creating a Store
        • Configuring your Store
      • Creating your first Product
      • Implementing a Shopping Cart
        • Using the Umbraco.Commerce.Cart Drop-in Shopping Cart
        • Creating a Custom Shopping Cart
      • Implementing a Checkout Flow
        • Using the Umbraco.Commerce.Checkout Drop-in Checkout Flow
        • Creating a Custom Checkout Flow
      • Configuring Store Access Permissions
  • How-To Guides
    • Overview
    • Configure SQLite support
    • Use an Alternative Database for Umbraco Commerce Tables
    • Customizing Templates
    • Configuring Cart Cleanup
    • Limit Order Line Quantity
    • Implementing Product Bundles
    • Implementing Member Based Pricing
    • Implementing Dynamically Priced Products
    • Implementing Personalized Products
    • Implementing a Currency Switcher
    • Building a Members Portal
    • Order Number Customization
    • Create an Order via Code
  • Key Concepts
    • Get to know the main features
    • Base Currency
    • Calculators
    • Currency Exchange Rate Service Provider
    • Dependency Injection
    • Discount Rules / Rewards
    • Events
      • List of validation events
      • List of notification events
    • Fluent API
    • Order Calculation State
    • Payment Forms
    • Payment Providers
    • Pipelines
    • Price/Amount Adjustments
    • Price Freezing
    • Product Adapters
    • Product Bundles
    • Product Variants
      • Complex Variants
    • Properties
    • ReadOnly and Writable Entities
    • Sales Tax Providers
    • Search Specifications
    • Settings Objects
    • Shipping Package Factories
    • Shipping Providers
    • Shipping Range/Rate Providers
    • Tax Sources
    • UI Extensions
      • Analytics Widgets
      • Entity Quick Actions
      • Order Line Actions
      • Order Properties
      • Order Collection Properties
      • Order Line Properties
      • Store Menu Items
    • Umbraco Properties
    • Unit of Work
    • Umbraco Commerce Builder
    • Webhooks
  • Reference
    • Stores
    • Shipping
      • Fixed Rate Shipping
      • Dynamic Rate Shipping
      • Realtime Rate Shipping
    • Payments
      • Configure Refunds
      • Issue Refunds
    • Taxes
      • Fixed Tax Rates
      • Calculated Tax Rates
    • Storefront API
      • Endpoints
        • Order
        • Checkout
        • Product
        • Customer
        • Store
        • Currency
        • Country
        • Payment method
        • Shipping method
        • Content
    • Management API
    • Go behind the scenes
    • Telemetry
Powered by GitBook
On this page
  • Registering an Order Line Action
  • The Order Line Action API

Was this helpful?

Edit on GitHub
Export as PDF
  1. Key Concepts
  2. UI Extensions

Order Line Actions

Order Line Actions UI Extension for Umbraco Commerce

PreviousEntity Quick ActionsNextOrder Properties

Last updated 2 months ago

Was this helpful?

Available from Umbraco Commerce 15.1.0

Order Line Actions allow you to display buttons against each order line of a cart/order enabling you to perform custom actions per order line.

Registering an Order Line Action

import { UcManifestOrderLineAction } from "@umbraco-commerce/backoffice";

export const manifests : UcManifestOrderLineAction[] = [
    {
        type: 'ucOrderLineAction',
        kind: 'default',
        alias: 'My.OrderLineAction.MyOrderLineAction',
        name: 'My Order Line Action',
        weight: 300,
        forEntityTypes: [ 'uc:cart', 'uc:order' ],
        api: () => import('./my-order-line-action.api.js'),
        meta: {
            label: "#orderLineActions_myOrderLineAction",
            icon: 'icon-star'
        }
    }
];

extensionRegistry.register(manifests);

Each entry must have a type of ucOrderLineAction along with a unique alias and name. Unless you wish to override the button, the kind key should be set to default. An api key that imports the implementation of the UcOrderLineActionApi interface, should be defined.

A meta entry provides configuration options for order line actions:

Name
Description

label

A label for this action (supports the # prefix localization string syntax)

icon

In icon to display for the action

The Order Line Action API

In order to define the logic to perform when an order line action button is clicked, you'll need to implement the UcOrderLineActionApi interface. This interface is defined as

export interface UcOrderLineActionApi extends UmbApi {
    manifest: UcManifestOrderLineAction;
    storeId: string;
    orderId: string;
    orderLineId: string;
    execute(): Promise<void>;
}

This provides order line action implementations with access to the defined manifest and contextual information via the storeId, orderId and orderLineId properties. It expects the implementation of an execute method to act.

An example implementation would be

// my-order-line-action.api.js

import { UcOrderLineActionApi, UcManifestOrderLineAction } from "@umbraco-commerce/backoffice";
import { UmbControllerBase } from "@umbraco-cms/backoffice/class-api";

export default class MyOrderLineActionApi extends UmbControllerBase implements UcOrderLineActionApi {
    manifest!: UcManifestOrderLineAction;
    storeId!: string;
    orderId!: string;
    orderLineId!: string;
    async execute() {
        console.log(`You clicked ${this.manifest!.meta.label} for order line ${this.orderLineId}`);
        return Promise.resolve();
    }
}
Custom Order Line Action