Skip to main content

Region

Region

A Region represents a geographical administrative unit, such as a Country, Province, State, Prefecture etc. This is an abstract class which is extended by the Country and Province entities. Regions can be grouped into Zones which are in turn used to determine applicable shipping and taxes for an Order.

Signature
class Region extends VendureEntity implements Translatable, HasCustomFields {
@Column() code: string;
@Column({ nullable: false, type: 'varchar' })
readonly type: RegionType;
name: LocaleString;
@Index()
@ManyToOne(type => Region, { nullable: true, onDelete: 'SET NULL' })
parent?: Region;
@EntityId({ nullable: true })
parentId?: ID;
@Column() enabled: boolean;
@OneToMany(type => RegionTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<Region>>;
@Column(type => CustomRegionFields)
customFields: CustomRegionFields;
}

code

property
string

A code representing the region. The code format will depend on the type of region. For example, a Country code will be a 2-letter ISO code, whereas a Province code could use a format relevant to the type of province, e.g. a US state code like "CA".

type

property
RegionType

name

property
LocaleString

parent

property

parentId

property

enabled

property
boolean

translations

property
Array<Translation<Region>>

customFields

property
CustomRegionFields