shaileshprajapati
Forum Replies Created
-
Forum: Plugins
In reply to: [CoCart - Headless REST API for WooCommerce] Remove cart Item not workingI have updated the plugin but I am getting the same response:
{“code”:”cocart_no_items”,”message”:”No items in cart.”,”data”:{“status”:404}}Forum: Plugins
In reply to: [CoCart - Headless REST API for WooCommerce] Remove cart Item not workingWhich latest patch are you suggesting to do ?
Forum: Plugins
In reply to: [CoCart - Headless REST API for WooCommerce] Remove cart Item not workingPlease let me know what should cause the issue ?
Forum: Plugins
In reply to: [CoCart - Headless REST API for WooCommerce] Remove cart Item not working<?php
include(‘config.php’);$args[‘cart_key’] = $_REQUEST[‘cart_key’]; // this is generated by us
$args[‘product_id’] = $_REQUEST[‘product_id’];
$args[‘quantity’] = $_REQUEST[‘quantity’];if( $_REQUEST[‘product_type’] == ‘variable’ ) {
$args[‘variation_id’] = $_REQUEST[‘variation_id’];
foreach($_POST[‘variations’] as $key => $value)
{
$args[‘variation’][$key] = $value;
}
}$curl = curl_init();
curl_setopt_array( $curl, array(
CURLOPT_URL => $base_url.”/wp-json/cocart/v1/add-item”,
CURLOPT_CUSTOMREQUEST => “POST”,
CURLOPT_POSTFIELDS => $args,
CURLOPT_RETURNTRANSFER => true
) );$response = curl_exec($curl);
curl_close($curl);
echo $response;
—
We are using above code to add item to the cart. Please check itForum: Plugins
In reply to: [CoCart - Headless REST API for WooCommerce] Remove cart Item not workingyes it is for guest customer and cart item key also exist.