Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Move taxes back to public meta
Jakub Draganek2e2701c10138
diff --git a/saleor/core/taxes/vatlayer/interface.py b/saleor/core/taxes/vatlayer/interface.pyindex 67e62e629b..cb57bb202f 100644--- a/saleor/core/taxes/vatlayer/interface.py+++ b/saleor/core/taxes/vatlayer/interface.py@@ -133,20 +133,18 @@ def apply_taxes_to_shipping_price_range(def assign_tax_to_object_meta(obj: Union["Product", "ProductType"], tax_code: str):if tax_code not in dict(TaxRateType.CHOICES):return- if not hasattr(obj, "private_meta"):+ if not hasattr(obj, "meta"):returntax_item = {"code": tax_code, "description": tax_code}- stored_tax_meta = obj.get_private_meta(namespace=META_NAMESPACE, client=META_FIELD)+ stored_tax_meta = obj.get_meta(namespace=META_NAMESPACE, client=META_FIELD)stored_tax_meta.update(tax_item)- obj.store_private_meta(- namespace=META_NAMESPACE, client=META_FIELD, item=stored_tax_meta- )+ obj.store_meta(namespace=META_NAMESPACE, client=META_FIELD, item=stored_tax_meta)obj.save()def get_tax_from_object_meta(obj: Union["Product", "ProductType"]) -> TaxType:- if not hasattr(obj, "private_meta"):+ if not hasattr(obj, "meta"):return TaxType(code="", description="")- tax = obj.get_private_meta(namespace=META_NAMESPACE, client=META_FIELD)+ tax = obj.get_meta(namespace=META_NAMESPACE, client=META_FIELD)return TaxType(code=tax.get("code", ""), description=tax.get("description", ""))diff --git a/tests/taxes/test_vatlayer.py b/tests/taxes/test_vatlayer.pyindex fb1d8cf9d7..90a81daec4 100644--- a/tests/taxes/test_vatlayer.py+++ b/tests/taxes/test_vatlayer.py@@ -63,9 +63,7 @@ def test_view_checkout_with_taxes(checkout.shipping_address = addresscheckout.save()product = checkout.lines.first().variant.product- product.private_meta = {- "taxes": {"vatlayer": {"code": "standard", "description": ""}}- }+ product.meta = {"taxes": {"vatlayer": {"code": "standard", "description": ""}}}product.save()response = client.get(reverse("checkout:index"))response_checkout_line = response.context[0]["checkout_lines"][0]