# VersaCommerce tags

Additional Liquid tags in VersaCommerce themes, such as sort, oddpaginate, cache, PayPal buttons and app calls.

Besides the standard Liquid tags, VersaCommerce themes can use the following tags.

## Iteration and output

### sort

Renders its block with a collection sorted by an attribute. Add `reversed` to sort in descending order.

```liquid
{% sort collection.products by title %}
  {% for product in collection.products %}
    {{ product.title }}
  {% endfor %}
{% endsort %}
```

### elementrow

Loops over the elements of a collection like `for`, with row-oriented loop attributes. It accepts `limit` and `offset`.

```liquid
{% elementrow product in collection.products limit: 8 %}
  {{ product.title }}
{% endelementrow %}
```

### oddpaginate

Paginates like [paginate](https://developer.versacommerce.de/articles/liquid-tags-theme-tags#paginate), but with a different page size for the first page. Use numbers, not variables, for both sizes.

```liquid
{% oddpaginate collection.products by 5, 12 %}
  {% for product in collection.products %}
    {{ product.title }}
  {% endfor %}
{% endoddpaginate %}
```

### filter

Builds tag filter links for a collection and gives you a `filterlist` inside the block.

```liquid
{% filter collection by any of tags %}
  ...
{% endfilter %}
```

### random

Outputs a random integer from 1 up to the given maximum.

```liquid
{% random 5 %}
```

### parameter

Assigns a value from a source expression to a variable.

```liquid
{% parameter sort_order = url_params.sort %}
```

### cache

Caches the rendered output of its block. The tag accepts attributes.

```liquid
{% cache %}
  {{ linklists.main | navigation }}
{% endcache %}
```

## Buttons and widgets

### paypal_button

Renders the PayPal button for the cart.

```liquid
{% paypal_button %}
```

### paypal_product_button

Renders the PayPal button for a product.

```liquid
{% paypal_product_button %}
```

### reservation_product_button

Renders the reservation button for a product, for shops with reservations enabled.

```liquid
{% reservation_product_button %}
```

### google_recaptcha

Renders the reCAPTCHA markup when reCAPTCHA is configured for the shop.

```liquid
{% google_recaptcha %}
```

### branding

Renders the platform branding markup.

```liquid
{% branding %}
```

## Tracking

### google_analytics

Renders the analytics snippet when it is configured for the shop.

```liquid
{% google_analytics %}
```

### google_conversion_tracker_snippet

Renders the configured Google conversion tracking snippet.

```liquid
{% google_conversion_tracker_snippet %}
```

## Apps

### external

Calls a command of an installed app from Liquid. Optional arguments pass parameters and name the result variable.

```liquid
{% external app: 'app-handle', command: 'command-handle' %}
```
