Ecommerce Shopify WordPress Discussion

Using Woo Commerce or Cocart. Add item in cart using REST API ONLY. The Challange is User is login using mobile and OTP. I have access token of User

Woocomerce import requests import json url = "https://{}/wp-json/wc/store/cart/add-item" payload = json.dumps({ "product_id": "24967", "quantity": "1" }) headers = { 'Authorization': 'Bearer ''', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) # Error : ` { "code": "woocommerce_rest_cart_invalid_product", "message": "This product cannot be added to the cart.", "data": { "status": 400 } } Here I know that the consumer key and consumer secret can be used but want to know how to create that using API. I am ready to create via application username and application password of admin. (We have used a digit authentication system here.(Firebase)) Coocart: import requests import json url = "https://{}/wp-json/cocart/v2/cart/add-item" payload = json.dumps({ "id": "24967", "quantity": "1", "meta_key": 148 }) headers = { 'Authorization': 'Bearer ''', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) # Response: { "cart_hash": "3f1d755f73315ca6b0c2c76f61934b3e", "cart_key": "148", "currency": { "currency_code": "INR", "currency_symbol": "₹", "currency_minor_unit": 2, "currency_decimal_separator": ".", "currency_thousand_separator": ",", "currency_prefix": "₹", "currency_suffix": "" }, "customer": { "billing_address": { "billing_first_name": "", "billing_last_name": "", "billing_company": "", "billing_address_1": "", "billing_address_2": "", "billing_city": "", "billing_state": "GJ", "billing_country": "IN", "billing_phone": "", "billing_email": "", "billing_pincode_invoice": "", "billing_gst_number": "" } } Created successfully but when I saw in the table: Table Name: wp_cocart_carts In cart_key getting some id instead of user_id. Here 148 Any help would be appreciated. I try all the possible methods and APIs. I want that cart to be added to the particular user who added the product.
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.