Skip to content

Instantly share code, notes, and snippets.

@cap340
Created March 30, 2026 03:11
Show Gist options
  • Select an option

  • Save cap340/41ae729f49f5a47f6374c9ece3d292d1 to your computer and use it in GitHub Desktop.

Select an option

Save cap340/41ae729f49f5a47f6374c9ece3d292d1 to your computer and use it in GitHub Desktop.
WooCommerce Product type
type ProductCategoryImage = {
id: number;
date_created: string;
date_created_gmt: string;
date_modified: string;
date_modified_gmt: string;
src: string;
name: string;
alt: string;
};
type ProductCategoryDisplay = "default" | "products" | "subcategories" | "both";
export type ProductCategory = {
id: number;
name: string;
slug: string;
parent: number;
description: string;
display: ProductCategoryDisplay;
image: null | ProductCategoryImage;
menu_order: number;
count: number;
};
export type ProductTag = {
id: number;
name: string;
slug: string;
description: string;
count: number;
};
type ProductType = "simple" | "grouped" | "external" | "variable";
type ProductStatus = "draft" | "pending" | "private" | "publish";
type CatalogVisibility = "visible" | "catalog" | "search" | "hidden";
type TaxStatus = "taxable" | "shipping" | "none";
type StockStatus = "instock" | "outofstock" | "onbackorder";
type BackOrders = "no" | "notify" | "yes";
type ProductDimension = {
length: string;
width: string;
height: string;
};
type ProductImage = {
id: number;
date_created: string;
date_created_gmt: string;
date_modified: string;
date_modified_gmt: string;
src: string;
name: string;
alt: string;
};
type ProductAttribute = {
id: number;
name: string;
position: number;
slug: string;
visible: boolean;
variation: boolean;
options: string[];
};
type ProductDefaultAttribute = {
id: number;
name: string;
option: string;
};
type ProductMetaData = {
id: number;
key: string;
value: string;
};
export type Product = {
id: number;
name: string;
slug: string;
permalink: string;
date_created: string;
date_created_gmt: string;
date_modified: string;
date_modified_gmt: string;
type: ProductType;
status: ProductStatus;
featured: boolean;
catalog_visibility: CatalogVisibility;
description: string;
short_description: string;
sku: string;
price: string;
regular_price: string;
sale_price: string;
date_on_sale_from: string | null;
date_on_sale_from_gmt: string | null;
date_on_sale_to: string | null;
date_on_sale_to_gmt: string | null;
price_html: string;
on_sale: boolean;
purchasable: boolean;
total_sales: number;
virtual: boolean;
downloadable: boolean;
tax_status: TaxStatus;
tax_class: string;
manage_stock: boolean;
stock_quantity: number | null;
stock_status: StockStatus;
backorders: BackOrders;
backorders_allowed: boolean;
backordered: boolean;
sold_individually: boolean;
weight: string;
dimensions: ProductDimension;
shipping_required: boolean;
shipping_taxable: boolean;
shipping_class: string;
shipping_class_id: number;
reviews_allowed: boolean;
average_rating: string;
rating_count: number;
related_ids: number[];
upsell_ids: number[];
cross_sell_ids: number[];
parent_id: number;
purchase_note: string;
categories: ProductCategory[];
tags: ProductTag[];
images: ProductImage[];
attributes: ProductAttribute[];
default_attributes: ProductDefaultAttribute[];
variations: number[];
grouped_products: number[];
menu_order: number;
meta_data: ProductMetaData[];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment