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() @Column() code: string;
@Column({ nullable: false, type: 'varchar' }) readonly @Column({ nullable: false, type: 'varchar' })
readonly type: RegionType;
name: LocaleString;
@Index() @ManyToOne(type => Region, { nullable: true, onDelete: 'SET NULL' }) @Index()
@ManyToOne(type => Region, { nullable: true, onDelete: 'SET NULL' })
parent?: Region;
@EntityId({ nullable: true }) @EntityId({ nullable: true })
parentId?: ID;
@Column() @Column() enabled: boolean;
@OneToMany(type => RegionTranslation, translation => translation.base, { eager: true }) @OneToMany(type => RegionTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<Region>>;
@Column(type => CustomRegionFields) @Column(type => CustomRegionFields)
customFields: CustomRegionFields;
}
Extends
Implements
- Translatable
- HasCustomFields
Members
code
property
type:
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
type:
RegionType
name
property
type:
LocaleString
parent
property
type:
Region
parentId
property
type:
ID
enabled
property
type:
boolean
translations
property
type:
Array<Translation<Region>>
customFields
property
type:
CustomRegionFields