Skip to content

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

Ability to configure if displayed taxes are gross or net

Anna Siwik3d1373a9c5d7
diff --git a/saleor/cart/views.py b/saleor/cart/views.py
index eef90d372d..e4260bf01f 100644
--- a/saleor/cart/views.py
+++ b/saleor/cart/views.py
@@ -123,22 +123,20 @@ def summary(request, cart):
def prepare_line_data(line):
first_image = line.variant.get_first_image()
- line_total = line.get_total(discounts, taxes)
return {
'product': line.variant.product,
'variant': line.variant.name,
'quantity': line.quantity,
'image': first_image,
- 'line_total': format_money(line_total.gross),
+ 'line_total': line.get_total(discounts, taxes),
'variant_url': line.variant.get_absolute_url()}
if cart.quantity == 0:
data = {'quantity': 0}
else:
- cart_total = cart.get_total(discounts, taxes)
data = {
'quantity': cart.quantity,
- 'total': format_money(cart_total.gross),
+ 'total': cart.get_total(discounts, taxes),
'lines': [prepare_line_data(line) for line in cart.lines.all()]}
return render(request, 'cart_dropdown.html', data)
diff --git a/saleor/checkout/core.py b/saleor/checkout/core.py
index 33b06e60a1..3d91de977b 100644
--- a/saleor/checkout/core.py
+++ b/saleor/checkout/core.py
@@ -3,6 +3,7 @@ from datetime import date
from functools import wraps
from django.conf import settings
+from django.contrib.sites.models import Site
from django.db import transaction
from django.forms.models import model_to_dict
from django.utils.encoding import smart_text
@@ -300,6 +301,8 @@ class Checkout:
shipping_method_name = (
smart_text(self.shipping_method) if self.is_shipping_required
else None)
+ include_taxes_in_prices = (
+ Site.objects.get_current().settings.include_taxes_in_prices)
order_data = {
'language_code': get_language(),
'billing_address': billing_address,
@@ -307,7 +310,8 @@ class Checkout:
'tracking_client_id': self.tracking_code,
'shipping_price': shipping_price,
'shipping_method_name': shipping_method_name,
- 'total': self.get_total()}
+ 'total': self.get_total(),
+ 'include_taxes_in_prices': include_taxes_in_prices}
if self.user.is_authenticated:
order_data['user'] = self.user
diff --git a/saleor/core/i18n.py b/saleor/core/i18n.py
index f95d4f7de6..f57147e77a 100644
--- a/saleor/core/i18n.py
+++ b/saleor/core/i18n.py
@@ -1,6 +1,5 @@
from django.utils.translation import pgettext_lazy
-
VAT_RATE_TYPE_TRANSLATIONS = {
'accommodation': pgettext_lazy('VAT rate type', 'accommodation'),
'admission to cultural events': pgettext_lazy(
diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.py
index aee4942946..a69a7bb647 100644
--- a/saleor/dashboard/order/views.py
+++ b/saleor/dashboard/order/views.py
@@ -1,6 +1,7 @@
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import permission_required
+from django.contrib.sites.models import Site
from django.db import transaction
from django.db.models import F, Q
from django.forms import modelformset_factory
@@ -56,7 +57,11 @@ def order_list(request):
@staff_member_required
@permission_required('order.edit_order')
def order_create(request):
- order = Order.objects.create(status=OrderStatus.DRAFT)
+ include_taxes_in_prices = (
+ Site.objects.get_current().settings.include_taxes_in_prices)
+ order = Order.objects.create(
+ status=OrderStatus.DRAFT,
+ include_taxes_in_prices=include_taxes_in_prices)
msg = pgettext_lazy(
'Dashboard message related to an order',
'Draft order created')
diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.py
index de0518b370..af47ad43eb 100644
--- a/saleor/dashboard/product/forms.py
+++ b/saleor/dashboard/product/forms.py
@@ -1,6 +1,7 @@
import bleach
from django import forms
from django.conf import settings
+from django.contrib.sites.models import Site
from django.db.models import Count
from django.forms.models import ModelChoiceIterator
from django.forms.widgets import CheckboxSelectMultiple
@@ -240,6 +241,12 @@ class ProductForm(forms.ModelForm, AttributesMixin):
self.fields['seo_title'] = SeoTitleField(
extra_attrs={'data-bind': self['name'].auto_id})
self.fields['tax_rate'].choices = get_tax_rate_type_choices()
+ if Site.objects.get_current().settings.include_taxes_in_prices:
+ self.fields['price'].label = pgettext_lazy(
+ 'Currency gross amount', 'Gross price')
+ else:
+ self.fields['price'].label = pgettext_lazy(
+ 'Currency net amount', 'Net price')
def clean_seo_description(self):
seo_description = prepare_seo_description(
diff --git a/saleor/dashboard/sites/forms.py b/saleor/dashboard/sites/forms.py
index 578d83f6f9..b2603a517c 100644
--- a/saleor/dashboard/sites/forms.py
+++ b/saleor/dashboard/sites/forms.py
@@ -30,11 +30,14 @@ class SiteSettingsForm(forms.ModelForm):
class SiteSettingsTaxesForm(forms.ModelForm):
class Meta:
model = SiteSettings
- fields = ['include_taxes_in_prices']
+ fields = ['include_taxes_in_prices', 'display_gross_prices']
labels = {
'include_taxes_in_prices': pgettext_lazy(
'Include taxes in prices',
- 'All taxes are included in my prices')}
+ 'All taxes are included in my prices'),
+ 'display_gross_prices': pgettext_lazy(
+ 'Display gross prices',
+ 'Show customers gross prices in storefront')}
class AuthorizationKeyForm(forms.ModelForm):
diff --git a/saleor/order/migrations/0046_orderline_tax_rate.py b/saleor/order/migrations/0046_orderline_taxes.py
similarity index 71%
rename from saleor/order/migrations/0046_orderline_tax_rate.py
rename to saleor/order/migrations/0046_orderline_taxes.py
index 89543030ef..733f5102ba 100644
--- a/saleor/order/migrations/0046_orderline_tax_rate.py
+++ b/saleor/order/migrations/0046_orderline_taxes.py
@@ -15,4 +15,9 @@ class Migration(migrations.Migration):
name='tax_rate',
field=models.DecimalField(decimal_places=2, default='0.0', max_digits=5),
),
+ migrations.AddField(
+ model_name='order',
+ name='include_taxes_in_prices',
+ field=models.BooleanField(default=True),
+ ),
]
diff --git a/saleor/order/models.py b/saleor/order/models.py
index afc002eb99..bf20606cb3 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -87,6 +87,7 @@ class Order(models.Model):
currency=settings.DEFAULT_CURRENCY, max_digits=12,
decimal_places=settings.DEFAULT_DECIMAL_PLACES, default=0)
discount_name = models.CharField(max_length=255, default='', blank=True)
+ include_taxes_in_prices = models.BooleanField(default=True)
objects = OrderQueryset.as_manager()
diff --git a/saleor/product/templatetags/price_ranges.py b/saleor/product/templatetags/price_ranges.py
index 67c4c5853d..e0030d41b0 100644
--- a/saleor/product/templatetags/price_ranges.py
+++ b/saleor/product/templatetags/price_ranges.py
@@ -3,6 +3,23 @@ from django import template
register = template.Library()
[email protected]_tag('product/_price_range.html')
-def price_range(price_range):
- return {'price_range': price_range}
[email protected]_tag('product/_price_range.html', takes_context=True)
+def price_range(context, price_range):
+ display_gross_prices = context['site'].settings.display_gross_prices
+ return {
+ 'price_range': price_range,
+ 'display_gross_prices': display_gross_prices}
+
+
[email protected]_tag(takes_context=True)
+def price_to_display(context, price, with_taxes=None):
+ """Return price to display (gross or net) depending on settings.
+
+ Extra with_taxes param forces return of gross (if true)
+ or net (if false) price.
+ """
+ if with_taxes is None:
+ display_gross_prices = context['site'].settings.display_gross_prices
+ else:
+ display_gross_prices = with_taxes
+ return price.gross if display_gross_prices else price.net
diff --git a/saleor/product/utils/variants_picker.py b/saleor/product/utils/variants_picker.py
index 7fbc08f759..134ccf33a3 100644
--- a/saleor/product/utils/variants_picker.py
+++ b/saleor/product/utils/variants_picker.py
@@ -1,5 +1,6 @@
from collections import defaultdict
+from django.contrib.sites.models import Site
from django_prices.templatetags import prices_i18n
from ...core.utils import to_local_currency
@@ -61,6 +62,8 @@ def get_variant_picker_data(
availability.price_range_undiscounted),
'priceRangeLocalCurrency': price_range_as_dict(
availability.price_range_local_currency)}
+ data['displayGrossPrices'] = (
+ Site.objects.get_current().settings.display_gross_prices)
return data
diff --git a/saleor/site/migrations/0014_sitesettings_include_taxes_in_prices.py b/saleor/site/migrations/0014_handle_taxes.py
similarity index 61%
rename from saleor/site/migrations/0014_sitesettings_include_taxes_in_prices.py
rename to saleor/site/migrations/0014_handle_taxes.py
index 2189c96110..c091fb7907 100644
--- a/saleor/site/migrations/0014_sitesettings_include_taxes_in_prices.py
+++ b/saleor/site/migrations/0014_handle_taxes.py
@@ -1,4 +1,4 @@
-# Generated by Django 2.0.3 on 2018-04-16 10:46
+# Generated by Django 2.0.3 on 2018-04-16 12:43
from django.db import migrations, models
@@ -10,6 +10,11 @@ class Migration(migrations.Migration):
]
operations = [
+ migrations.AddField(
+ model_name='sitesettings',
+ name='display_gross_prices',
+ field=models.BooleanField(default=True),
+ ),
migrations.AddField(
model_name='sitesettings',
name='include_taxes_in_prices',
diff --git a/saleor/site/models.py b/saleor/site/models.py
index c28f0794cb..4b62e8fec0 100644
--- a/saleor/site/models.py
+++ b/saleor/site/models.py
@@ -20,6 +20,7 @@ class SiteSettings(models.Model):
'menu.Menu', on_delete=models.SET_NULL, related_name='+', blank=True,
null=True)
include_taxes_in_prices = models.BooleanField(default=True)
+ display_gross_prices = models.BooleanField(default=True)
class Meta:
permissions = (
diff --git a/saleor/static/dashboard/scss/components/_form.scss b/saleor/static/dashboard/scss/components/_form.scss
index d90798d79b..1fc1947137 100644
--- a/saleor/static/dashboard/scss/components/_form.scss
+++ b/saleor/static/dashboard/scss/components/_form.scss
@@ -113,6 +113,10 @@
.datepicker {
cursor: pointer;
}
+
+ .checkbox-helptext {
+ padding-left: 66px;
+ }
}
.switch {
diff --git a/saleor/static/js/components/variant-picker.js b/saleor/static/js/components/variant-picker.js
index 7864f1889e..82300d360a 100644
--- a/saleor/static/js/components/variant-picker.js
+++ b/saleor/static/js/components/variant-picker.js
@@ -30,6 +30,7 @@ export default $(document).ready((e) => {
<VariantPrice
availability={variantPickerData.availability}
store={variantPickerStore}
+ displayGrossPrices={variantPickerData.displayGrossPrices}
/>,
variantPriceContainer
);
diff --git a/saleor/static/js/components/variantPicker/VariantPrice.js b/saleor/static/js/components/variantPicker/VariantPrice.js
index 43964e4447..7cbd1acf83 100644
--- a/saleor/static/js/components/variantPicker/VariantPrice.js
+++ b/saleor/static/js/components/variantPicker/VariantPrice.js
@@ -4,29 +4,48 @@ import React, { Component, PropTypes } from 'react';
export default observer(class VariantPrice extends Component {
static propTypes = {
availability: PropTypes.object.isRequired,
- store: PropTypes.object
+ store: PropTypes.object,
+ displayGrossPrices: PropTypes.bool
}
render() {
let priceText, priceUndiscountedText, priceLocalCurrency, isDiscount;
- const { availability, store } = this.props;
+ const { availability, store, displayGrossPrices } = this.props;
const variant = store.variant;
if (!store.isEmpty) {
// variant price
isDiscount = variant.price.gross !== variant.priceUndiscounted.gross;
- priceText = `${variant.price.grossLocalized}`;
- priceUndiscountedText = `${variant.priceUndiscounted.grossLocalized}`;
- if (variant.priceLocalCurrency) {
- priceLocalCurrency = variant.priceLocalCurrency.grossLocalized;
+ if (displayGrossPrices) {
+ priceText = `${variant.price.grossLocalized}`;
+ priceUndiscountedText = `${variant.priceUndiscounted.grossLocalized}`;
+ if (variant.priceLocalCurrency) {
+ priceLocalCurrency = variant.priceLocalCurrency.grossLocalized;
+ }
+ }
+ else {
+ priceText = `${variant.price.netLocalized}`;
+ priceUndiscountedText = `${variant.priceUndiscounted.netLocalized}`;
+ if (variant.priceLocalCurrency) {
+ priceLocalCurrency = variant.priceLocalCurrency.netLocalized;
+ }
}
} else {
// if there's no variant, fall back to product price
const { discount, priceRange, priceRangeUndiscounted } = availability;
isDiscount = discount && !!Object.keys(discount).length;
- priceText = `${priceRange.minPrice.grossLocalized}`;
- priceUndiscountedText = `${priceRangeUndiscounted.minPrice.grossLocalized}`;
- if (availability.priceRangeLocalCurrency) {
- priceLocalCurrency = availability.priceRangeLocalCurrency.minPrice.grossLocalized;
+ if (displayGrossPrices) {
+ priceText = `${priceRange.minPrice.grossLocalized}`;
+ priceUndiscountedText = `${priceRangeUndiscounted.minPrice.grossLocalized}`;
+ if (availability.priceRangeLocalCurrency) {
+ priceLocalCurrency = availability.priceRangeLocalCurrency.minPrice.grossLocalized;
+ }
+ }
+ else {
+ priceText = `${priceRange.minPrice.netLocalized}`;
+ priceUndiscountedText = `${priceRangeUndiscounted.minPrice.netLocalized}`;
+ if (availability.priceRangeLocalCurrency) {
+ priceLocalCurrency = availability.priceRangeLocalCurrency.minPrice.netLocalized;
+ }
}
}
return (
diff --git a/templates/cart/_subtotal_table.html b/templates/cart/_subtotal_table.html
index bdeb55d53f..fccc6dc8cc 100644
--- a/templates/cart/_subtotal_table.html
+++ b/templates/cart/_subtotal_table.html
@@ -1,5 +1,5 @@
{% load i18n %}
-{% load price_range from price_ranges %}
+{% load price_ranges %}
{% load prices_i18n %}
{% if shipping_required %}
@@ -11,12 +11,14 @@
<div class="col-4">
<h3 class="text-right cart-subtotal" data-value="{{ cart_total.gross|amount }}" {% if local_cart_total is not None %}data-value-local="{{ local_cart_total.gross|amount }}"{% endif %}>
{% spaceless %}
- {{ cart_total.gross|amount:'html' }}
+ {% price_to_display cart_total as price %}
+ {{ price|amount:'html' }}
{% if local_cart_total is not None and local_cart_total.gross %}
<br>
<small>
&asymp;
- {{ local_cart_total.gross|amount:'html' }}
+ {% price_to_display local_cart_total as price %}
+ {{ price|amount:'html' }}
</small>
{% endif %}
{% endspaceless %}
@@ -54,6 +56,7 @@
<div class="row">
<div class="col-8 cart__total__subtotal">
<h3>{% trans "Total" context "Order subtotal" %}</h3>
+ <small>{% trans "Shipment and taxes calculated at checkout" context "Cart summary text" %}</small>
</div>
<div class="col-4">
{% spaceless %}
diff --git a/templates/cart/index.html b/templates/cart/index.html
index adcd54590b..8370fbf316 100644
--- a/templates/cart/index.html
+++ b/templates/cart/index.html
@@ -2,6 +2,7 @@
{% load i18n %}
{% load prices_i18n %}
{% load staticfiles %}
+{% load price_to_display from price_ranges %}
{% load get_thumbnail from product_images %}
{% block title %}{% trans "Your cart" context "Cart page title" %} — {{ block.super }}{% endblock %}
@@ -63,7 +64,10 @@
<small class="cart__line__quantity-error text-danger"></small>
</div>
<div class="cart-item-price col-md-5 col-12" data-product-id="{{ line.variant.pk }}">
- <p class="text-right">{{ line.get_total.gross|amount:'html' }}</p>
+ <p class="text-right">
+ {% price_to_display line.get_total as price %}
+ {{ price|amount:'html' }}
+ </p>
</div>
</div>
</div>
diff --git a/templates/cart_dropdown.html b/templates/cart_dropdown.html
index f799b1f720..dc0c249324 100644
--- a/templates/cart_dropdown.html
+++ b/templates/cart_dropdown.html
@@ -1,7 +1,9 @@
{% load i18n %}
+{% load prices_i18n %}
{% load staticfiles %}
{% load get_thumbnail from product_images %}
{% load placeholder %}
+{% load price_to_display from price_ranges %}
<div class="container">
{% if quantity > 0 %}
@@ -24,7 +26,10 @@
</div>
<div class="col-md-2">
<div class="float-right">
- <h3>{{ line.line_total }}</h3>
+ <h3>
+ {% price_to_display line.line_total as price %}
+ {{ price|amount:'html' }}
+ </h3>
</div>
</div>
</div>
@@ -32,13 +37,17 @@
</div>
<div class="row cart-dropdown__total" data-quantity="{{ quantity }}">
<div class="col-md-8">
- <h3>{% trans "Subtotal" context "Order subtotal" %}
- <br>
- <span>{% trans "(Shipment and taxes calculated at checkout)" context "Cart dropdown text" %}</span></h3>
+ <h3>
+ {% trans "Subtotal" context "Order subtotal" %}<br>
+ <span>{% trans "Shipment and taxes calculated at checkout" context "Cart dropdown text" %}</span>
+ </h3>
</div>
<div class="col-md-4">
<h3 class="float-md-right price {% if lines|length <= 2 %}single{% endif %}" data-quantity="{{ quantity }}">
- <p>{{ total }}</p>
+ <p>
+ {% price_to_display total as price %}
+ {{ price|amount:'html' }}
+ </p>
</h3>
</div>
</div>
diff --git a/templates/checkout/details.html b/templates/checkout/details.html
index 17a9767a1b..c81be9b5b6 100644
--- a/templates/checkout/details.html
+++ b/templates/checkout/details.html
@@ -2,6 +2,7 @@
{% load i18n %}
{% load prices_i18n %}
+{% load price_to_display from price_ranges %}
{% load staticfiles %}
{% block title %}{% trans "Checkout" context "Checkout page title" %} — {{ block.super }}{% endblock %}
@@ -39,7 +40,10 @@
<span class="checkout__review__variant">{{ line.variant }}</span></p>
</div>
<div class="col-4">
- <p class="float-right">{{ line.get_total.gross|amount }}</p>
+ <p class="float-right">
+ {% price_to_display line.get_total as price %}
+ {{ price|amount }}
+ </p>
</div>
</div>
{% endfor %}
@@ -58,7 +62,8 @@
<div class="col-4">
<p class="float-right">
{% if checkout.shipping_method %}
- {{ checkout.shipping_method.get_total_price.gross|amount }}
+ {% price_to_display checkout.shipping_method.get_total_price as price %}
+ {{ price|amount:'html' }}
{% else %}
&mdash;
{% endif %}
diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.html
index 0cd7e171c9..6a28ac756f 100644
--- a/templates/dashboard/order/detail.html
+++ b/templates/dashboard/order/detail.html
@@ -3,6 +3,7 @@
{% load prices_i18n %}
{% load i18n %}
{% load i18n_address_tags %}
+{% load price_ranges %}
{% load materializecss %}
{% load status %}
{% load staticfiles %}
@@ -283,7 +284,7 @@
{% trans "Item" context "Order table header" %}
</th>
<th class="right-align">
- {% trans "Price gross" context "Order table header" %}
+ {% trans "Price" context "Order table header" %}
</th>
<th class="right-align">
{% trans "Quantity" context "Order table header" %}
@@ -310,7 +311,8 @@
</span>
</td>
<td class="right-align">
- {{ line.unit_price.gross|amount:'html' }}
+ {% price_to_display line.unit_price order.include_taxes_in_prices as price %}
+ {{ price|amount:'html' }}
</td>
<td class="right-align">
{% if perms.order.edit_order and order.is_draft %}
@@ -335,7 +337,8 @@
{% endif %}
</td>
<td class="right-align">
- {{ line.get_total.gross|amount:'html' }}
+ {% price_to_display line.get_total order.include_taxes_in_prices as price %}
+ {{ price|amount:'html' }}
</td>
</tr>
{% endfor %}
@@ -406,9 +409,15 @@
<p><strong>{% trans "Grand total" context "Order totals header" %}</strong></p>
</td>
<td class="right-align">
- <p>{{ order.get_subtotal.net|amount:'html' }}</p>
+ <p>
+ {% price_to_display order.get_subtotal order.include_taxes_in_prices as price %}
+ {{ price|amount:'html' }}
+ </p>
<p>{{ order.total.tax|amount:'html' }}</p>
- <p>{{ order.shipping_price.gross|amount:'html' }}</p>
+ <p>
+ {% price_to_display order.shipping_price order.include_taxes_in_prices as price %}
+ {{ price|amount:'html' }}
+ </p>
{% if order.is_draft or order.discount_amount %}
<p>{% discount_as_negative order.discount_amount html=True %}</p>
{% endif %}
diff --git a/templates/dashboard/order/modal/cancel_line.html b/templates/dashboard/order/modal/cancel_line.html
index bfd43bd293..d431d6836d 100644
--- a/templates/dashboard/order/modal/cancel_line.html
+++ b/templates/dashboard/order/modal/cancel_line.html
@@ -3,6 +3,7 @@
{% load i18n %}
{% load materializecss %}
{% load prices_i18n %}
+{% load price_to_display from price_ranges %}
{% block action_url %}
{% url 'dashboard:orderline-cancel' order_pk=order.pk line_pk=item.pk %}
@@ -47,13 +48,15 @@
{{ item.product_sku }}
</td>
<td class="right-align">
- {{ item.unit_price.gross|amount:'html' }}
+ {% price_to_display item.unit_price as price %}
+ {{ price|amount:'html' }}
</td>
<td class="right-align">
{{ item.quantity }}
</td>
<td class="right-align">
- {{ item.get_total.gross|amount:'html' }}
+ {% price_to_display item.get_total as price %}
+ {{ price|amount:'html' }}
</td>
</tr>
</tbody>
diff --git a/templates/dashboard/sites/detail.html b/templates/dashboard/sites/detail.html
index 6981871420..0a6703c435 100644
--- a/templates/dashboard/sites/detail.html
+++ b/templates/dashboard/sites/detail.html
@@ -86,6 +86,20 @@
</p>
</div>
</div>
+ <div class="row">
+ <div class="col s12 m4 l12">
+ <h4>
+ {% trans "Show customers gross prices in storefront" context "Site settings field" %}
+ </h4>
+ <p>
+ {% if site.display_gross_prices %}
+ {% trans "Yes" context "Show customers gross prices setting description" %}
+ {% else %}
+ {% trans "No" context "Show customers gross prices setting description" %}
+ {% endif %}
+ </p>
+ </div>
+ </div>
</div>
<div class="card-action">
<a class="btn-flat waves-effect" href="{% url 'dashboard:site-configure-taxes' pk=site.pk %}">
diff --git a/templates/dashboard/sites/taxes_form.html b/templates/dashboard/sites/taxes_form.html
index c728c318e9..bcbc75b5dd 100644
--- a/templates/dashboard/sites/taxes_form.html
+++ b/templates/dashboard/sites/taxes_form.html
@@ -41,7 +41,33 @@
{% trans "Taxes" context "Dashboard site taxes settings form title" %}
</div>
<div class="row">
- {{ taxes_form.include_taxes_in_prices|materializecss }}
+ <div class="col s12">
+ {{ taxes_form.include_taxes_in_prices|materializecss }}
+ </div>
+ <div class="col s12 checkbox-helptext">
+ <h6>
+ {% blocktrans context "Dashboard site taxes settings form help text" %}
+ If selected, all prices entered in dashboard will include taxes.
+ {% endblocktrans %}
+ </h6>
+ <h6>
+ {% blocktrans context "Dashboard site taxes settings form help text" %}
+ For example: product with entered price 4.00 € and 19% VAT will have net price calculated to 3.36 € (rounded).
+ {% endblocktrans %}
+ </h6>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col s12">
+ {{ taxes_form.display_gross_prices|materializecss }}
+ </div>
+ <div class="col s12 checkbox-helptext">
+ <h6>
+ {% blocktrans context "Dashboard site taxes settings form help text" %}
+ If selected, prices displayed for customers in storefront will be gross. Taxes will be properly calculated at checkout.
+ {% endblocktrans %}
+ </h6>
+ </div>
</div>
</div>
<div class="card-action right-align">
diff --git a/templates/order/_ordered_items_table.html b/templates/order/_ordered_items_table.html
index 5d31896db5..18f3c87e70 100644
--- a/templates/order/_ordered_items_table.html
+++ b/templates/order/_ordered_items_table.html
@@ -63,7 +63,10 @@
<p class="float-right">x {{ line.quantity }}</p>
</div>
<div class="col-md-6 col-12">
- <p class="float-right">{{ line.get_total.gross|amount:'html' }}</p>
+ <p class="float-right">
+ {% price_to_display item.get_total as price %}
+ {{ price|amount:'html' }}
+ </p>
</div>
</div>
</div>
@@ -79,7 +82,10 @@
</p>
</div>
<div class="col-4">
- <p class="float-right">{{ order.shipping_price.gross|amount:'html' }}</p>
+ <p class="float-right">
+ {% price_to_display order.shipping_price as price %}
+ {{ price|amount:'html' }}
+ </p>
</div>
</div>
</div>
diff --git a/templates/product/_price_range.html b/templates/product/_price_range.html
index 2cf10f2c0f..c83869a3a2 100644
--- a/templates/product/_price_range.html
+++ b/templates/product/_price_range.html
@@ -3,7 +3,12 @@
<span>
<span>
- {% if price_range.start != price_range.stop %}{% trans "from" context "product price range" %} {% endif %}{{ price_range.start.gross|amount:'html' }}
+ {% if price_range.start != price_range.stop %}{% trans "from" context "product price range" %} {% endif %}
+ {% if display_gross %}
+ {{ price_range.start.gross|amount:'html' }}
+ {% else %}
+ {{ price_range.start.net|amount:'html' }}
+ {% endif %}
</span>
<div class="small">
({{ price_range.start.net|amount:'html' }} + {{ price_range.start.tax|amount:'html' }} VAT)
diff --git a/templates/product/details.html b/templates/product/details.html
index d9897b8ab3..32fd057032 100644
--- a/templates/product/details.html
+++ b/templates/product/details.html
@@ -4,7 +4,7 @@
{% load i18n %}
{% load markdown from markdown %}
{% load prices_i18n %}
-{% load price_range from price_ranges %}
+{% load price_ranges %}
{% load staticfiles %}
{% load get_thumbnail product_first_image from product_images %}
{% load build_absolute_uri from urls %}
@@ -130,13 +130,17 @@
<h2 class="product__info__price">
<span>{% price_range availability.price_range %}</span>
{% if availability.discount %}
- <small class="product__info__price__undiscounted">{{ availability.price_range_undiscounted.start.gross|amount:'html' }}</small>
+ <small class="product__info__price__undiscounted">
+ {% price_to_display availability.price_range_undiscounted.start as price %}
+ {{ price|amount:'html' }}
+ </small>
{% endif %}
{% if availability.price_range_local_currency %}
<br>
<small class="text-info">
&asymp;
- {{ availability.price_range_local_currency.start.gross|amount:'html' }}
+ {% price_to_display availability.price_range_local_currency.start as price %}
+ {{ price|amount:'html' }}
</small>
{% endif %}
</h2>
@@ -146,7 +150,8 @@
{% block orderform %}
{% if show_variant_picker %}
{% csrf_token %}
- <div id="variant-picker" data-variant-picker-data="{{ variant_picker_data }}" data-action="{% url 'product:add-to-cart' product_id=product.pk slug=product.get_slug %}"></div>
+ <div id="variant-picker" data-variant-picker-data="{{ variant_picker_data }}"
+ data-action="{% url 'product:add-to-cart' product_id=product.pk slug=product.get_slug %}" data-display-gross-price="{{ request.site.settings.display_gross_prices }}"></div>
{% else %}
<form id="product-form" role="form" class="product-form clearfix" method="post" action="{% url 'product:add-to-cart' product_id=product.pk slug=product.get_slug %}" novalidate>
{% csrf_token %}