Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Site name automatically added to emails

Pacu285dadb27c29e
diff --git a/saleor/order/models.py b/saleor/order/models.py
index bdf182343f..2465fa0c98 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -23,6 +23,7 @@ from ..discount.models import Voucher
from ..product.models import Product
from ..userprofile.models import Address
from ..search import index
+from ..site.utils import get_site_name
from . import OrderStatus
@@ -172,7 +173,7 @@ class Order(models.Model, ItemSet, index.Indexed):
email = self.get_user_current_email()
payment_url = build_absolute_uri(
reverse('order:details', kwargs={'token': self.token}))
- context = {'payment_url': payment_url}
+ context = {'payment_url': payment_url, 'site_name': get_site_name()}
send_templated_mail(
'order/confirm_order', from_email=settings.ORDER_FROM_EMAIL,
recipient_list=[email], context=context)
@@ -408,7 +409,7 @@ class Payment(BasePayment):
email = self.order.get_user_current_email()
order_url = build_absolute_uri(
reverse('order:details', kwargs={'token': self.order.token}))
- context = {'order_url': order_url}
+ context = {'order_url': order_url, 'site_name': get_site_name()}
send_templated_mail(
'order/payment/confirm_payment', context=context,
from_email=settings.ORDER_FROM_EMAIL, recipient_list=[email])
diff --git a/saleor/site/utils.py b/saleor/site/utils.py
index 84b6caf0e3..04ac1035aa 100644
--- a/saleor/site/utils.py
+++ b/saleor/site/utils.py
@@ -32,6 +32,11 @@ def get_domain():
return get_site_settings().domain
+def get_site_name():
+ """Returns site name from default settings."""
+ return get_site_settings().name
+
+
def get_site_settings_uncached(settings_id=None):
# type: (str) -> SiteSettings
"""Query database for settings object."""
diff --git a/templates/templated_email/order/confirm_order.email b/templates/templated_email/order/confirm_order.email
index 2afabd3d75..7bdede0e73 100644
--- a/templates/templated_email/order/confirm_order.email
+++ b/templates/templated_email/order/confirm_order.email
@@ -12,6 +12,6 @@ Thank you for your order. To see your payment details please visit:
{{ payment_url }}
Sincerely,
-Saleor Team
+{{ site_name }}
{% endblocktrans %}
{% endblock %}
diff --git a/templates/templated_email/order/payment/confirm_payment.email b/templates/templated_email/order/payment/confirm_payment.email
index 997cf8e490..94a60037af 100644
--- a/templates/templated_email/order/payment/confirm_payment.email
+++ b/templates/templated_email/order/payment/confirm_payment.email
@@ -12,6 +12,6 @@ Thank you for your payment. To see your payment details please visit:
{{ order_url }}
Sincerely,
-Saleor Team
+{{ site_name }}
{% endblocktrans %}
{% endblock %}