shopify api cart checkout return empty cart

braincorpdev
Visitor
1 0 0

Hello ! I'am building a flask app that require shopify API call. 
yesterday my create_shopify_checkout function was able to return a checkout cart.
Today, the checkout web_url returned is empty. it looks like it can fetch the correct variant_id since the image_url provide the expected image for that variant.

I may have made modification to the dev store and/or the app at shopify pages, but I can't figure out which one is responsible for that problem.

Also, yesterday, when the cart checkout was not returned as empty, I was able to click on the checkout link. Now if I click on the checkout link, it require a password.

here is my python code for the create_shopify_checkout.

def create_shopify_checkout(array_of_objects, access_token, store_url):
# Endpoint URL
url = f"https://{store_url}/admin/api/2023-04/checkouts.json"
access_token = current_user.token_shopify
# Headers
headers = {
"X-Shopify-Access-Token": access_token,
"Content-Type": "application/json"
}

# Payload
data = {
"checkout": {
"line_items": array_of_objects
}
}

# Make the POST request
response = requests.post(url, headers=headers, json=data)

# Return the response
return response.json()

here is the payload format used as array_of_objects

{'checkout': {'line_items': [{'variant_id': 46525462511906, 'quantity': 1}]}}

and here is the output: 
{'checkout': {'completed_at': None, 'created_at': '2023-09-06T06:05:43-04:00', 'currency': 'EUR', 'presentment_currency': 'EUR', 'customer_id': None, 'customer_locale': 'en', 'device_id': None, 'discount_code': None, 'discount_codes': [], 'email': None, 'legal_notice_url': None, 'location_id': None, 'name': '#36926260838690', 'note': '', 'note_attributes': {}, 'order_id': None, 'order_status_url': None, 'order': None, 'payment_due': '25.99', 'payment_url': 'https://deposit.us.shopifycs.com/sessions', 'payments': [], 'phone': None, 'shopify_payments_account_id': None, 'privacy_policy_url': None, 'refund_policy_url': None, 'requires_shipping': True, 'reservation_time_left': 0, 'reservation_time': None, 'source_identifier': None, 'source_name': '56113725441', 'source_url': None, 'subscription_policy_url': None, 'subtotal_price': '25.99', 'shipping_policy_url': None, 'tax_exempt': False, 'taxes_included': True, 'terms_of_sale_url': None, 'terms_of_service_url': None, 'token': 'ab8b3c32b1f788a585b3d40c1bb098ec', 'total_price': '25.99', 'total_tax': '0.00', 'total_tip_received': '0.00', 'total_line_items_price': '25.99', 'updated_at': '2023-09-06T06:05:43-04:00', 'user_id': None, 'web_url': 'https://braincorpdev.myshopify.com/81100636450/checkouts/ab8b3c32b1f788a585b3d40c1bb098ec', 'line_items': [{'id': '26b117d90025d4d5576801814126b1fa', 'key': '26b117d90025d4d5576801814126b1fa', 'product_id': 8557077987618, 'variant_id': 46525462511906, 'sku': 'Product A_blue', 'vendor': 'Your Vendor Name', 'title': 'Product A', 'variant_title': 'blue / small', 'image_url': 'https://cdn.shopify.com/s/files/1/0811/0063/6450/files/image_94632bfb-3057-4338-953a-80caedcb8725.pn...', 'taxable': True, 'requires_shipping': True, 'gift_card': False, 'price': '25.99', 'compare_at_price': None, 'line_price': '25.99', 'properties': {}, 'quantity': 1, 'grams': 0, 'fulfillment_service': 'manual', 'applied_discounts': [], 'discount_allocations': [], 'tax_lines': []}], 'gift_cards': [], 'tax_lines': [], 'tax_manipulations': [], 'shipping_line': None, 'shipping_rate': None, 'shipping_address': None, 'credit_card': None, 'billing_address': None, 'applied_discount': None, 'applied_discounts': [], 'discount_violations': []}}

Please, i'am struggling so much.



Reply 1 (1)

SBD_
Shopify Staff
1829 269 409

Hey @braincorpdev 

 

That's a development store which requires a password for access. The password can be found in Admin > Online Store > See Store Password.

Scott | Developer Advocate @ Shopify