nagasurendra commited on
Commit
b2bc4c2
·
verified ·
1 Parent(s): 221944a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -171,7 +171,7 @@ def add_to_cart():
171
  addons_string = "; ".join(addons_details)
172
 
173
  # Calculate the total price (item price + add-ons)
174
- total_price = item_price + addons_total_price
175
 
176
  try:
177
  # Save the cart item in Salesforce
@@ -297,7 +297,7 @@ def update_quantity():
297
  addons_price = 0 # Default to 0 if parsing fails
298
 
299
  # Calculate the new price
300
- new_price = (base_price + addons_price) * quantity
301
 
302
  # Update the record in Salesforce
303
  sf.Cart_Item__c.update(cart_item_id, {
@@ -331,7 +331,7 @@ def checkout():
331
  return jsonify({"success": False, "message": "Cart is empty"})
332
 
333
  # Calculate the total price of the order
334
- total_price = sum(item['Price__c'] * item['Quantity__c'] for item in cart_items)
335
 
336
  # Create the order in Salesforce
337
  order_data = {
 
171
  addons_string = "; ".join(addons_details)
172
 
173
  # Calculate the total price (item price + add-ons)
174
+ total_price = (item_price * quantity) + sum(addon['price'] for addon in addons)
175
 
176
  try:
177
  # Save the cart item in Salesforce
 
297
  addons_price = 0 # Default to 0 if parsing fails
298
 
299
  # Calculate the new price
300
+ new_price = (base_price * quantity) + addons_price
301
 
302
  # Update the record in Salesforce
303
  sf.Cart_Item__c.update(cart_item_id, {
 
331
  return jsonify({"success": False, "message": "Cart is empty"})
332
 
333
  # Calculate the total price of the order
334
+ total_price = sum(item['Price__c'] for item in cart_items)
335
 
336
  # Create the order in Salesforce
337
  order_data = {