# Template Replacements

This page documents legacy templates that have been replaced in the Vitrin system

If your theme relies on old template helpers, you must replace them with the corresponding Vitrin templates to ensure compatibility with the latest structure.

---
### What changed

The old Twig helper is no longer supported.
To render grouped products, your theme should now include the new Vitrin Jinja template.

---

## Template Replacement Reference

| Old Template Name | New Vitrin Template |
|---|---|
| `template_for_store_messages` | `vitrin:shared/store_messages.jinja` |
| `template_for_shipping_destination_currency_lang` | `vitrin:shared/region_settings_dialog.jinja` |
| `template_for_products_attributes` | `vitrin:products/filters.jinja` |
| `template_for_category_metafields` | `vitrin:shared/metafields.jinja` |
| `template_for_products_badge` | `vitrin:products/badge.jinja` |
| `template_for_blogs_metafields` | `vitrin:shared/metafields.jinja` |
| `template_for_cart_products_list` | `vitrin:cart/products_list.jinja` |
| `template_for_cart_payments_widget` | `vitrin:cart/payment_widgets.jinja` |
| `template_for_cart_apple_pay_button` | `vitrin:checkout/apple-pay-quick-checkout.jinja` |
| `template_for_cart_gifts_widget` | `vitrin:cart/gift-card.jinja` |
| `template_for_product_badge` | `vitrin:products/badge.jinja` |
| `template_for_product_loyalty_points_widget` | `vitrin:products/loyalty_points_widget.jinja` |
| `template_for_product_payments_widget` | `vitrin:products/payment_widgets.jinja` |
| `template_for_product_variants_list` | `vitrin:products/variants_list.jinja` |
| `template_for_product_custom_input_fields` | `vitrin:products/custom_input_fields.jinja` |
| `template_for_product_apple_pay_button` | `vitrin:checkout/apple-pay-quick-checkout.jinja` |
| `template_for_product_grouped` | `vitrin:products/grouped-product.jinja` |
| `template_for_product_metafields` | `vitrin:shared/metafields.jinja` |

---

## Usage Examples

### 1. Store Messages
Displays store-wide notification messages.

File: `header.jinja`

`{% include 'vitrin:shared/store_messages.jinja' %}`

---

### 2. Region Settings Dialog (Shipping Destination / Language)
Displays a dialog that allows customers to select their region and language.

File: `layout.jinja`

`{% include 'vitrin:shared/region_settings_dialog.jinja' %}`

[more details..](https://docs.zid.sa/region-language-popup-1861342m0)

---

### 3. Products Filters (Products Attributes)
Displays product filtering options on category and product listing pages.

Files: `category.jinja` or `products.jinja`  
Required variable: `async` (set to true for async loading)

```python
{% if products.filters|length > 0 %}
  {% set async = true %}
  {% include 'vitrin:products/filters.jinja' %}
{% endif %}
```
---

### 4. Products Badge
Displays product badges on product cards.

File: `components/product-card.jinja`

```python
{% if product.badge %}
  {% include 'vitrin:products/badge.jinja' %}
{% endif %}
```
---

### 5. Product Badge (Product Details Page)
Displays the product badge on the product details page.

File: `templates/product.jinja`


```python
{% if product.badge %}
  {% include 'vitrin:products/badge.jinja' %}
{% endif %}
```

---

### 6. Metafields (Shared Template)
Displays custom metafields for different entities.  
This shared template is used for products, categories, blogs, and pages.

Required variable: `entity`

#### Product Metafields
File: `templates/product.jinja`


```python
{% if product.metafields %}
  {% set entity = product %}
  {% include 'vitrin:shared/metafields.jinja' %}
{% endif %}
```

#### Category Metafields
File: `templates/category.jinja`


```python
{% if category.metafields %}
  {% set entity = category %}
  {% include 'vitrin:shared/metafields.jinja' %}
{% endif %}
```

#### Page Metafields
File: `templates/page.jinja`


```python
{% if page.metafields %}
  {% set entity = page %}
  {% include 'vitrin:shared/metafields.jinja' %}
{% endif %}
```

---

### 7. Cart Products List
Displays the list of products in the shopping cart.

File: `templates/cart.jinja`


```html
<div class="template_for_cart_products_list">
  {% include 'vitrin:cart/products_list.jinja' %}
</div>
```

---

### 8. Cart Payment Widgets
Displays available payment method widgets in the cart (for example: Tabby, Tamara).

File: `templates/cart.jinja`

`{% include 'vitrin:cart/payment_widgets.jinja' %}`

---

### 9. Apple Pay Quick Checkout Button
Displays the Apple Pay button for quick checkout.  
Used on both cart and product pages.

#### Cart & Product Page
Files: `templates/cart.jinja` & `templates/product.jinja`

`{% include 'vitrin:checkout/apple-pay-quick-checkout.jinja' %}`

[more details..](https://docs.zid.sa/apple-pay-quick-checkout-1859764m0)

---

### 10. Cart Gift Card Widget
Displays the gift card or gift wrapping option in the cart.

File: `templates/cart.jinja`


```python
{% if store.settings.checkout.gift_order_settings.is_gift_order_enabled == '1' %}
  {% include 'vitrin:cart/gift-card.jinja' %}
{% endif %}
```

[more details..](https://docs.zid.sa/gift-card-1697835m0)

---

### 11. Product Loyalty Points Widget
Displays loyalty points information on the product page.

File: `templates/product.jinja`

`{% include 'vitrin:products/loyalty_points_widget.jinja' %}`

---

### 12. Product Payment Widgets
Displays available payment method widgets on the product page.

File: `templates/product.jinja`

`{% include 'vitrin:products/payment_widgets.jinja' %}`

---

### 13. Product Variants List
Displays product variant options such as size or color selectors.

File: `templates/product.jinja`

`{% include 'vitrin:products/variants_list.jinja' %}`

---

### 14. Product Custom Input Fields
Displays custom input fields for product personalization.

File: `templates/product.jinja`


```python
{% if product.custom_input_fields %}
  {% include 'vitrin:products/custom_input_fields.jinja' %}
{% endif %}
```

---

### 15. Grouped Product
Displays grouped or related products on the product page.

File: `templates/product.jinja`

`{% include 'vitrin:products/grouped-product.jinja' %}`

---

## Future replacements

When more legacy templates are replaced, they will be added to this page using the same format.
