Prints a form that enables the customer to subscribe to availability notifications sent once the product is back in stock.

Description

You can define when the form should be displayed to customers by using the tag's display attribute. You can display the form e.g. only if the product is out of stock.

For more information about availability notifications, see our user guide.

Syntax

{AvailabilityNotificationForm(
    display: string,
    order_newsletter: boolean,
    success: string,
    failed: string
)}

Scope

Required scope: tuote

Implementing availability notifications in a theme

You can add the availability notification subscription form to the product page by using the {AvailabilityNotificationForm} tag. You can define a customized introductory text to the form in the tag's before attribute.

{AvailabilityNotificationForm(
    before: '
        <h2>{%AvailabilityNotificationIntroTitle}</h2>
        <p>{%AvailabilityNotificationIntroText}</p>
    ',
    display: 'outofstock',
    order_newsletter: true
)}

The example shows how to display the form only when the product is out of stock by using the display attribute. To add the newsletter subscription form to the form, use the order_newsletter:true attribute.

Apart from the availability notifications subscription form, your theme needs to contain the email template /emails/product/back-in-stock.html, which is used to format the availability notification messages.

You can use product tags in this template.Email subject and contents are printed by using the {EmailTitle} and {EmailMessage} tags.

Attribuutit

display:

Defines conditions under which the form is displayed to customers.

Allowed values:

  • 'unavailable': the product is out of stock and its stock information says that the sales should be stopped if the product is out of stock (default value)
  • 'out_of_stock': the product is out of stock but the product still can be purchased
  • 'backordered': the product can be pre-ordered (see also How do I create a pre-order product?)
  • 'always': the form is displayed in any case
order_newsletter:

The value true adds also the newsletter subscription option to the form.

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

success:

The message that is displayed after the form has been sent successfully.

By default, the entry 'AvailabilityNotificationFormSuccess' is displayed from the online store's dictionary.

failed:

The message that is displayed after the form couldn't be sent.

By default, the entry 'AvailabilityNotificationFormFailed' is displayed from the online store's dictionary.

after/before:

By using the after and before attributes you can define content that is output either after or before the tag's output.

Allowed values:The HTML and Interface markup

E.g.

  • before: '<p>Tämä merkkaus näkyy ennen tagin omaa sisältöä.</p>'
  • after: '<p>Tämä taas näkyy tagin oman sisällön jälkeen.</p>'

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

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:The HTML and Interface markup

E.g. or:'Sisältöä ei löytynyt.'