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.

Returns: string

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

Department

Returns a department inside a shop.

Returns: string

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

Price

Generates a price between min and max (inclusive).

Parameters

NameTypeDefaultDescription
minnumber1

The minimum price.

maxnumber1000

The maximum price.

decnumber2

The number of decimal places.

symbolstring''

The currency value to use.

Returns: string

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.

Returns: string

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

Product Adjective

Returns an adjective describing a product.

Returns: string

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

Product Description

Returns a product description.

Returns: string

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

Product Material

Returns a material of a product.

Returns: string

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

Product Name

Generates a random descriptive product name.

Returns: string

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