Skip to content

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

Add charge taxes on shipping to shop settings update mutation

fowczarek84c81d40bc01
diff --git a/saleor/graphql/shop/mutations.py b/saleor/graphql/shop/mutations.py
index abc0974a81..51bbe268c8 100644
--- a/saleor/graphql/shop/mutations.py
+++ b/saleor/graphql/shop/mutations.py
@@ -15,6 +15,8 @@ class ShopSettingsInput(graphene.InputObjectType):
description='Include taxes in prices')
display_gross_prices = graphene.Boolean(
description='Display prices with tax in store')
+ charge_taxes_on_shipping = graphene.Boolean(
+ description='Charge taxes on shipping')
track_inventory_by_default = graphene.Boolean(
description='Enable inventory tracking')
default_weight_unit = WeightUnitsEnum(description='Default weight unit')
diff --git a/tests/api/test_shop.py b/tests/api/test_shop.py
index ca5b44fcc5..32cac679b6 100644
--- a/tests/api/test_shop.py
+++ b/tests/api/test_shop.py
@@ -241,6 +241,7 @@ def test_query_charge_taxes_on_shipping(api_client, site_settings):
charge_taxes_on_shipping = site_settings.charge_taxes_on_shipping
assert data['chargeTaxesOnShipping'] == charge_taxes_on_shipping
+
def test_shop_settings_mutation(
staff_api_client, site_settings, permission_manage_settings):
query = """
@@ -248,23 +249,33 @@ def test_shop_settings_mutation(
shopSettingsUpdate(input: $input) {
shop {
headerText,
- includeTaxesInPrices
+ includeTaxesInPrices,
+ chargeTaxesOnShipping
+ }
+ errors{
+ field,
+ message
}
}
}
"""
+ charge_taxes_on_shipping = site_settings.charge_taxes_on_shipping
+ new_charge_taxes_on_shipping = not charge_taxes_on_shipping
variables = {
'input': {
'includeTaxesInPrices': False,
- 'headerText': 'Lorem ipsum'}}
+ 'headerText': 'Lorem ipsum',
+ 'chargeTaxesOnShipping': new_charge_taxes_on_shipping}}
response = staff_api_client.post_graphql(
query, variables, permissions=[permission_manage_settings])
content = get_graphql_content(response)
data = content['data']['shopSettingsUpdate']['shop']
assert data['includeTaxesInPrices'] == False
assert data['headerText'] == 'Lorem ipsum'
+ assert data['chargeTaxesOnShipping'] == new_charge_taxes_on_shipping
site_settings.refresh_from_db()
assert not site_settings.include_taxes_in_prices
+ assert site_settings.charge_taxes_on_shipping == new_charge_taxes_on_shipping
def test_shop_domain_update(staff_api_client, permission_manage_settings):