From dcccdcd9ec1096ee74bc134d58466affdf13f2d0 Mon Sep 17 00:00:00 2001 From: C <0xicl33n@gmail.com> Date: Wed, 7 Jan 2026 11:36:24 -0800 Subject: [PATCH] fix pricing not being entered --- src/asquare.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/asquare.py b/src/asquare.py index 2331f68..fbc3438 100644 --- a/src/asquare.py +++ b/src/asquare.py @@ -301,7 +301,9 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None): set_upc = lego_set["set_barcode"] set_image = lego_set["set_image"] pw_name = lego_set["pw_name"] - # Price updates disabled - enriching without price + set_adjustedprice = lego_set["set_adjustredprice"] + + price_in_cents = int(set_adjustedprice * 100) # Retry logic for version conflicts (race conditions with concurrent updates) max_retries = 3 @@ -383,7 +385,19 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None): "item_variation_data", {} ).copy() - # Update only specific fields (price skipped) + # Check if this variation has VARIABLE_PRICING + current_pricing_type = updated_var_data.get("pricing_type") + + # Only set price if not using variable pricing + if current_pricing_type != "VARIABLE_PRICING": + updated_var_data["price_money"] = { + "amount": price_in_cents, + "currency": "USD", + } + print(f"[@DEBUG] Setting price: ${set_adjustedprice} for variation {variation_id}") + else: + print(f"[@WARNING] Skipping price update for {variation_id} - has VARIABLE_PRICING enabled") + updated_var_data["sku"] = set_number # LEGO set number updated_var_data["upc"] = ( set_upc if set_upc else None @@ -398,7 +412,11 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None): updated_variations.append(updated_var) variation_found = True else: - # Keep other variations as-is + # Keeprice_money": { + "amount": price_in_cents, + "currency": "USD", + }, + "p other variations as-is updated_variations.append(existing_var) # If variation wasn't found (shouldn't happen), create new one