Prints purchase tools (variation and customization selection) and the button with which a product can be added to the shopping cart.

Kuvaus

The purchase form should always be implemented using this tag, because custom purchase forms may break as the software evolves.

The tag doesn't print anything in the following situations:

  • The product is out of stock (and the sales were set to stop in stock management if the product is out of stock)
  • The product doesn't have a price

Purchase tools include the following:

  • Variation selection
  • Customization fields
  • Downloadable file selection

Syntaksi

{ProductBuy( includetax: boolean, stock: boolean, variations: string, variation_codes: boolean, variation_availability: boolean, variation_compare_price: boolean, show: string, quantity: string, values: int, default: int, price_format: string )}

Näkyvyys

Toimii näkyvyydessä: tuote

The required scope is always set in the following templates:

Templates
Single product template
Product images

Attribuutit

includetax:

Determines whether the tag prints the price including VAT.

Allowed values: true/false. Default value: true.

stock:

Determines if the product's stock balance is printed.

Allowed values: true/false. The default value is false.

variations:

Defines the HTML selection element used for printing product variations.

Allowed values:

  • 'select': variation selection is printed as a select list (default value)
  • 'radio': variation selection is printed as radio buttons.
variation_codes:

Sets the tag to also print variation's product codes on the selection list.

Allowed values: true/false. The default value is false.

variation_availability:

Sets the tag to also print variations' stock balance.

Allowed values: true/false. Default value: true.

variation_compare_price:

Sets the tag to print also the variation's comparison price, i.e. the original price if the product has been discounted.

Allowed values: true/false. Default value: true.

show:

Defines whether to print all variations or just the variations that are available.

Allowed values:

  • 'all': prints all variations (default value)
  • 'available': prints only the variations that are currently available
quantity:

Defines the HTML element used for selecting the quantity.

Allowed values:

  • 'input': a text field is used as a selection element (default value)
  • 'select': a select list is used as a selection element
values:

Defines the values available on the quantity attribute's select list (only integers allowed).

The attribute is used only if the quantity attribute has the value 'select'.

Allowed values: pipe-separated integers. E.g. values: '1|2|3|4'.

default:

Defines the default value of the quantity attribute's select list.

The attribute is used only if the quantity attribute has the value 'select'.

Allowed values: integers.

price_format:

Determines the price information display format.

Sallitut arvot:
  • string (default): The price information is printed as a string, which may also include formatting and additions dependent on other attributes of the tag (e.g., currency symbol).
  • decimal: The price information is printed as a decimal number using a decimal point (e.g., 9.90), which works in, among other things, JavaScript code.

    If price_format: 'decimal' is in use, other price information formatting attributes do not affect the tag's output.

before/after:

With the before and after attributes, you can define content that is output before or after the content produced by the tag.

Allowed values: text that may contain HTML and Interface markup.

E.g.

  • before: '<p>This markup appears before the tag's own content.</p>'.
  • after: '<p>This appears after the tag's own content.</p>'

If the tag does not produce any content, the content of the before and after attributes will also not be displayed.

escape:

Adds an escape character before quotation marks in the output. The attribute makes it easier to process the tag-produced content when using JavaScript.

Allowed values: true/false. The default value is false.

or:

Defines alternative content that is displayed if the tag itself does not produce any content.

Allowed values: text that may contain HTML and Interface markup.

E.g. or:'Content not found.'