[ [ 'quantity' => (int)$quantity, 'product_id' => $itemID, // use the BigCommerce product ID 'name' => $itemDescription, 'price' => (float)$itemPrice ] ] ]; // Convert to JSON $cart_json = json_encode($cart_data); // Initialize cURL $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $store_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $cart_json); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'X-Auth-Token: ' . $api_token, 'Content-Type: application/json', 'Accept: application/json' ]); // Execute and capture response $response = curl_exec($ch); curl_close($ch); if ($response) { echo "Item successfully added to cart."; } else { echo "Error adding item to cart."; } ?>