From d5520f3a894d2c0ee542514775870b5c69e0c8d3 Mon Sep 17 00:00:00 2001 From: James Kachel Date: Fri, 26 Jul 2024 11:27:11 -0500 Subject: [PATCH] Fixing discount code payload generation for Google Analytics (#2313) --- ecommerce/views/v0/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ecommerce/views/v0/__init__.py b/ecommerce/views/v0/__init__.py index 3892d56889..fb52016664 100644 --- a/ecommerce/views/v0/__init__.py +++ b/ecommerce/views/v0/__init__.py @@ -738,7 +738,10 @@ def _create_ga4_context(self, order): } if order.discounts.count() > 0: ga_purchase_payload["coupon"] = ",".join( - [discount.discount_code for discount in order.discounts] + [ + discount.redeemed_discount.discount_code + for discount in order.discounts.all() + ] ) return ga_purchase_payload