Просмотр исходного кода

main: get product variation id before updating inventory

brid 1 год назад
Родитель
Сommit
e6be8a9409
1 измененных файлов с 11 добавлено и 0 удалено
  1. 11 0
      app/main.py

+ 11 - 0
app/main.py

@@ -789,6 +789,17 @@ async def stripe_webhook(request: Request, background_tasks: BackgroundTasks):
 
                 if product_list:
                     for product_info in product_list:
+                        # We need to read the product file and get the variation ID
+                        product = read_file(
+                            settings.git_repo,
+                            f"products/{product_info.filename}",
+                            settings.document_match,
+                            settings.block_types,
+                        )
+                        
+                        # Get the variation ID based on size and style
+                        product_variation_id = get_variation_id(product, product_info.size, product_info.style)
+                        
                         update_product_inventory(
                             product_info.filename,
                             product_info.quantity,