# Matrix

## Overview

Matrix Option is quite interesting and a bit unusual one. It adds a possibility to create a table of discrete values which can be chosen and used in product price calculation formula.

This is how the table looks like:

![](https://3552609976-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M50Y01TKemmHpSl6feB%2F-M50Y0ZIgvH_dYi7thL3%2F-M50Y8o2sY0J21TCabyu%2Fmatrix-option-appearance.png?generation=1587016420562547\&alt=media)

## Settings

These are:

* values in columns
* values in rows
* template
* actual matrix table

This is how Matrix Option table's values are added:

![](https://3552609976-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M50Y01TKemmHpSl6feB%2F-M50Y0ZIgvH_dYi7thL3%2F-M50Y8o4KSc_Pr2MoAUw%2Fmatrix-option-settings-example-1.png?generation=1587016421176466\&alt=media)

First, add values for columns. They must be separated by this sign: `|` . Next, do the same for rows. Next click on *Generate* button and a table will be generated where you can add values for each cell. **Only numeric values can be added to cells!**&#x20;

**As for values for rows and columns, they can be either words or numeric. Or even both!** These screenshots shows the proper syntax:

1\) numeric values

![](https://3552609976-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M50Y01TKemmHpSl6feB%2F-M50Y0ZIgvH_dYi7thL3%2F-M50Y8o6iuKmQphX6Aqn%2Fmatrix-numeric-values.png?generation=1587016420345816\&alt=media)

2\) numeric or words

![](https://3552609976-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M50Y01TKemmHpSl6feB%2F-M50Y0ZIgvH_dYi7thL3%2F-M50Y8o8s63ZFjRhZ4Mr%2Fmatrix-numeric-or-words-values.png?generation=1587016420969674\&alt=media)

3\) numeric AND words

![](https://3552609976-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M50Y01TKemmHpSl6feB%2F-M50Y0ZIgvH_dYi7thL3%2F-M50Y8oA73zMPXd9HlG3%2Fmatrix-numeric-and-words-values.png?generation=1587016420738157\&alt=media)

In this case a special syntax is used. You have to split option values by `|` and split a value for a formula and a value for displaying by `:` (space;colon;space). **Again, as it is very important, use colon (**`:`**) surrounded by spaces from both sides!**

Why we need to split a value for a formula at all? Well, it is quite handy if you want to display a word or two as displaying name in the table, but still be able to use some numeric value in the formula. In case of choosing a cell within a column with the name like this `100 : One Hundred` "100" will be set to a special var of this option and "One Hundred" will be just displayed in the table and cart/order meta.

We reviewed columns and rows values. So, what about the third setting called "template"? This setting is used for mastering a template which will be shown as this option value in cart/order meta. You can use two *special template variables* here: `{{{row}}}` and `{{{col}}}` .

## Special Variables

```
{option_slug_col}
```

It holds a value of the chosen column

```
{option_slug_row}
```

It holds a value of the chosen row
