Skip to main content

commerce Domain

The commerce domain maps domain keywords to underlying faker implementations.

Faker Documentation

Methods

commerce.department

Returns a department inside a shop.

No parameters.

Examples:

Shows the default commerce.department call.

commerce.department

Returns: Grocery

commerce.isbn

Returns a random ISBN identifier.

ArgTypeRequiredDescription
separatorstringnoSeparator inserted between generated items.
variant10|13noISBN length variant: use 10 for ISBN-10 or 13 for ISBN-13.

Examples:

Shows commerce.isbn when optional params are omitted.

commerce.isbn()

Returns: 978-0-7031-0133-4

Shows commerce.isbn using separator.

commerce.isbn(separator="-")

Returns: 978-0-7031-0133-4

Shows commerce.isbn using variant.

commerce.isbn(variant=10)

Returns: 0-7031-0133-1

commerce.price

Generates a price between min and max (inclusive).

ArgTypeRequiredDescription
decintegernoThe number of decimal places.
maxnumbernoThe maximum price.
minnumbernoThe minimum price.
symbolstringnoThe currency value to use.

Examples:

Shows commerce.price in use.

commerce.price(dec=2, max=10, min=1, symbol="$")

Returns: $4.79

Shows commerce.price when optional params are omitted.

commerce.price()

Returns: 417.69

Shows commerce.price using dec.

commerce.price(dec=2)

Returns: 417.69

Shows commerce.price using max.

commerce.price(max=100)

Returns: 42.29

Shows commerce.price using min.

commerce.price(max=10, min=1)

Returns: 4.79

Shows commerce.price using symbol.

commerce.price(symbol="$")

Returns: $417.69

commerce.product

Returns a short product name.

No parameters.

Examples:

Shows the default commerce.product call.

commerce.product

Returns: Gloves

commerce.productAdjective

Returns an adjective describing a product.

No parameters.

Examples:

Shows the default commerce.productAdjective call.

commerce.productAdjective

Returns: Handmade

commerce.productDescription

Returns a product description.

No parameters.

Examples:

Shows the default commerce.productDescription call.

commerce.productDescription

Returns: New Sausages model with 1 GB RAM, 303 GB storage, and bruised features

commerce.productMaterial

Returns a material of a product.

No parameters.

Examples:

Shows the default commerce.productMaterial call.

commerce.productMaterial

Returns: Gold

commerce.productName

Generates a random descriptive product name.

No parameters.

Examples:

Shows the default commerce.productName call.

commerce.productName

Returns: Handmade Plastic Bacon

commerce.upc

Returns a valid UPC-A (12 digits).

ArgTypeRequiredDescription
prefixstringnoOptional numeric prefix for the UPC body (0-11 digits).

Examples:

Shows commerce.upc when optional params are omitted.

commerce.upc()

Returns: 470310133543

Shows commerce.upc using prefix.

commerce.upc(prefix="01234")

Returns: 012344703103