Product

E-commerce product with pricing, inventory, dimensions, and create/update variants.

Report an issue
ecommerce

Install

$ npx shadcn@latest add @open-types/product

Source

export type CurrencyCode = string;

export type DimensionsUnit = "cm" | "in" | "m" | "ft";

export interface Dimensions {
  length: number;
  width: number;
  height: number;
  unit?: DimensionsUnit;
}

export interface Product {
  id: string;
  name: string;
  description?: string;
  price: number;
  compareAtPrice?: number;
  currency?: CurrencyCode;
  sku: string;
  stock: number;
  categories?: string[];
  tags?: string[];
  isActive?: boolean;
  weight?: number;
  dimensions?: Dimensions;
}

export type ProductCreate = Omit<Product, "id">;

export type ProductUpdate = Partial<ProductCreate>;
export type CurrencyCode = string;

export type DimensionsUnit = "cm" | "in" | "m" | "ft";

export interface Dimensions {
  length: number;
  width: number;
  height: number;
  unit?: DimensionsUnit;
}

export interface Product {
  id: string;
  name: string;
  description?: string;
  price: number;
  compareAtPrice?: number;
  currency?: CurrencyCode;
  sku: string;
  stock: number;
  categories?: string[];
  tags?: string[];
  isActive?: boolean;
  weight?: number;
  dimensions?: Dimensions;
}

export type ProductCreate = Omit<Product, "id">;

export type ProductUpdate = Partial<ProductCreate>;