Satchmo Template Filters and Tags

Filters and Tags provide great flexibility when working with templates and are an important part of Django, and by association, Satchmo.

It is possible to easily create your own filters and tags (you can read the Django Template documentation for details), but Satchmo also includes several useful filters and tags already.

Filter Reference

To use Tags in templates, you need to use the load tag to load the custom library into the template.


Returns the discounted total for a given cart item.


{% load satchmo_discounts %}
{{ cart|discount_cart_total:"discount" }}

The discount argument, if omitted will only result in returning the total for the cart, not the discounted total.


Returns the discounted line total for this cart item.


{% load satchmo_discounts %}
{{ product|discount_line_total:"sale" }}


Returns the product price with the discount applied.


{% load satchmo_discounts %}
{{ product|discount_price:"sale" }}

You would replace product with your actual product template variable.


Returns the discount as a ratio, making sure that the percent is under 1.


{% load satchmo_discounts %}
{{ discount|discount_ratio }}


Returns the amount saved by the discount.


{% load satchmo_discounts %}
{{ product|discount_saved:"sale" }}


Returns the product unit price with the best auto discount applied.


{% load satchmo_discounts %}
{{ product|sale_price }}

This filter finds all applicable Site-wide Sales via Auto Discounts, then sorts them by percentage. The return value would represent the greatest discount available for a product.

Tag Reference

To use Tags in templates, you need to use the load tag to load the custom library into the template.


Filters the list of installed applications returned by django.contrib.admin.templatetags.adminapplist, excluding applications installed by Satchmo.


{% load satchmo_adminapplist %}
{% filter_admin_app_list app_list varname %}

In the above usage you would replace app_list with the list of applications you would like to filter, and varname with the name of the variable you want to be returned in the template context.


Returns a formatted list of in-process orders.


{% load satchmo_adminorder_tags %}
{% inprocess_order_list %}

This tag renders another template (default is templates\admin\_ordercount_list.html), which produces an html list, using the django.template.Library().inclusion_tag library.


Allows for easy upselling or cross-selling of a product. Up-selling can imply selling something additional, or selling something that is more profitable or otherwise preferable for the seller instead of the original sale [1] .

A practical example would be If you were selling ebooks, you could make a checkbox on the ebook detail page, which would allow your customer to order the companion CD. This is useful as you are able to provide customers with a direct way of purchasing a companion item without the need to search for it.


{% load satchmo_upsell %}
{% product_upsell product %}

This tag renders another template (default is templates\upsell\product_upsell.html) using the django.template.Library().inclusion_tag library. The tag should be used within a html form, most commonly within the order form for the product you want to upsell.

No product options

Currently, the goal product doesn’t have any options. It can be a be a product variation, but can’t be a configurable product by itself.

[1]Wikipedia article Up-selling