fix pricing not being entered
This commit is contained in:
1 parent
dbc1115249
commit
dcccdcd9ec
1 file changed
+21
-3
+21
-3
@@ -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
|
||||
|
||||
Reference in new issue
Block a user