Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -277,15 +277,15 @@ def update_quantity():
|
|
277 |
return jsonify({"success": False, "error": "Email and item name are required."}), 400
|
278 |
|
279 |
try:
|
280 |
-
# Query the cart item using the correct
|
281 |
cart_items = sf.query(
|
282 |
-
f"SELECT Id, Quantity__c FROM Cart_Item__c WHERE Customer_Email__c = '{email}' AND
|
283 |
)['records']
|
284 |
|
285 |
if not cart_items:
|
286 |
return jsonify({"success": False, "error": "Cart item not found."}), 404
|
287 |
|
288 |
-
# Get the first matching record ID
|
289 |
cart_item_id = cart_items[0]['Id']
|
290 |
|
291 |
# Update the quantity in Salesforce
|
|
|
277 |
return jsonify({"success": False, "error": "Email and item name are required."}), 400
|
278 |
|
279 |
try:
|
280 |
+
# Query the cart item using the correct fields
|
281 |
cart_items = sf.query(
|
282 |
+
f"SELECT Id, Quantity__c FROM Cart_Item__c WHERE Customer_Email__c = '{email}' AND Name = '{item_name}'"
|
283 |
)['records']
|
284 |
|
285 |
if not cart_items:
|
286 |
return jsonify({"success": False, "error": "Cart item not found."}), 404
|
287 |
|
288 |
+
# Get the first matching record ID (assuming the item name is unique per user)
|
289 |
cart_item_id = cart_items[0]['Id']
|
290 |
|
291 |
# Update the quantity in Salesforce
|