Skip to content
On this page

Commerce

Module to generate commerce and product related entries.

color

Deprecated

This method is deprecated and will be removed in a future version.

Returns a human readable color name.

Available since v3.0.0

Returns: string

ts
faker.commerce.color(): string
faker.commerce.color() // => "salmon"
faker.commerce.color() // 'red'

department

Returns a department inside a shop.

Available since v3.0.0

Returns: string

ts
faker.commerce.department(): string
faker.commerce.department() // => "Toys"
faker.commerce.department() // 'Garden'

price

Generates a price between min and max (inclusive).

Available since v3.0.0

Parameters

NameTypeDefaultDescription
minnumber1

The minimum price.

maxnumber1000

The maximum price.

decnumber2

The number of decimal places.

symbolstring''

The currency value to use.

Returns: string

ts
faker.commerce.price(min: number = 1, max: number = 1000, dec: number = 2, symbol: string = ''): string
faker.commerce.price() // => "549.00"
faker.commerce.price() // 828.00
faker.commerce.price(100) // 904.00
faker.commerce.price(100, 200) // 154.00
faker.commerce.price(100, 200, 0) // 133
faker.commerce.price(100, 200, 0, '$') // $114

product

Returns a short product name.

Available since v3.0.0

Returns: string

ts
faker.commerce.product(): string
faker.commerce.product() // => "Towels"
faker.commerce.product() // 'Computer'

productAdjective

Returns an adjective describing a product.

Available since v3.0.0

Returns: string

ts
faker.commerce.productAdjective(): string
faker.commerce.productAdjective() // => "Bespoke"
faker.commerce.productAdjective() // 'Handcrafted'

productDescription

Returns a product description.

Available since v5.0.0

Returns: string

ts
faker.commerce.productDescription(): string
faker.commerce.productDescription() // => "The Football Is Good For Training And Recreati...
faker.commerce.productDescription() // 'Andy shoes are designed to keeping...'

productMaterial

Returns a material of a product.

Available since v3.0.0

Returns: string

ts
faker.commerce.productMaterial(): string
faker.commerce.productMaterial() // => "Granite"
faker.commerce.productMaterial() // 'Rubber'

productName

Generates a random descriptive product name.

Available since v3.0.0

Returns: string

ts
faker.commerce.productName(): string
faker.commerce.productName() // => "Bespoke Rubber Fish"
faker.commerce.productName() // 'Incredible Soft Gloves'

Released under the MIT License.