Home > widget-integration > CartAPI > processItemProperties

CartAPI.processItemProperties() method

Process item properties before adding to cart Override to add shop-specific properties or modify default behavior

Signature:

protected processItemProperties(properties: Record<string, unknown>, sellingPlanId: string | null): Record<string, unknown>;

Parameters

Parameter

Type

Description

properties

Record<string, unknown>

Base properties for the line item

sellingPlanId

string | null

Selling plan ID if applicable

Returns:

Record<string, unknown>

Processed properties with any additional fields

Example

class CustomCartAPI extends CartAPI {
  protected processItemProperties(properties, sellingPlanId) {
    const processed = super.processItemProperties(properties, sellingPlanId);
    return {
      ...processed,
      _shopSource: 'custom-widget',
      _timestamp: Date.now(),
    };
  }
}