set_session

Table of contents

The set_session tag allows will store some values in the web session. This allows a website to 'remember' values across multiple pages and requests. This can for example be used to assemble a list of products, and then submit these via one form.

Variables set using these tag, can be retrieved using the session object

It accepts two (unnamed) arguments:

The variable name

  • A string containing only alphanumeric characters and underscores

The variable value

  • A string or number, at most 5000 characters long.

  • Be aware that numbers are converted to strings

Example

The following code sets the session variable 'first_name' to have the value 'Plate'.

{% set_session "first_name", "Plate" %}
After this, {{ session.first_name }} will output Plate

Need help?

Do you have any question which is not answered in this knowledge base? Contact us. We are here to help you.