From aa06f420fe63d68e3ed9f5a0fcd34cf86b35d42f Mon Sep 17 00:00:00 2001 From: SysAdmin Date: Wed, 8 Oct 2025 18:49:45 +0100 Subject: [PATCH] Add: Diagnostic logging for variant selection in TeleBot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added logging to diagnose why orders are created with £0 pricing: - Log when product has variants and variant selection is shown - Log WARNING when product has no variants and base price is used - Helps identify if variants are missing or not being detected Troubleshooting: Orders showing £0 despite variants having correct prices 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- TeleBot/TeleBot/Handlers/CallbackHandler.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TeleBot/TeleBot/Handlers/CallbackHandler.cs b/TeleBot/TeleBot/Handlers/CallbackHandler.cs index ebaa5f8..96c21f6 100644 --- a/TeleBot/TeleBot/Handlers/CallbackHandler.cs +++ b/TeleBot/TeleBot/Handlers/CallbackHandler.cs @@ -599,11 +599,14 @@ namespace TeleBot.Handlers // If variants exist, show variant selection with quickbuy flow if (product.Variants?.Any() == true) { + _logger.LogInformation("Product {ProductId} has {Count} variants, showing selection", productId, product.Variants.Count); await ShowVariantSelectionForQuickBuy(bot, callbackQuery.Message!, session, product, quantity); return; } - // Add to cart with base product + // Add to cart with base product (ONLY if no variants) + _logger.LogWarning("Quick buy for product {ProductId} ({Name}) with NO variants - using base price £{Price}", + productId, product.Name, product.Price); session.Cart.AddItem(productId, product.Name, product.Price, quantity, null, null); // Track quick buy action