• I’ve tried adding cart items using Postman and even though Postman returns successfully, when I inspect the front end of the staging site and endpoints, I am not seeing the data I added via Postman.

    My endpoint for viewing the cart data:https://staging.example.example.co.uk/wp-json/cocart/v2/cart/items/’ is returning only the cart item I added manually via the front end.

    My endpoint for adding to cart: https://staging.example.example.co.uk/wp-json/cocart/v2/cart/add-item/

    JSON Data being sent:

    { "id": "10494", // Product ID for the "large" variation "quantity": "1", "item_data": { "pa_name_here": "amesviapostman", "pa_number_print": "10" }, "variation": { "attribute_pa_size": "large", // Customize this based on your product's attributes "attribute_pa_add-name-and-number": "yes-add-3-99", // Customize this based on your product's attributes "attribute_pa_arm-patches-to-be-added": "no-thank-you" // Customize this based on your product's attributes } }

    Question

    Do you know why the data I sent using Postman is not being added to the cart endpoint or front end? I can only assume it’s something to so with session cookies, but I don’t know why or how to remedy this.

    My ultimate goal is to send cart data from one site to another. I realise batch sending isn’t possible right now, so I am going to use a workaround to send one at a time until it is possible.

    • This topic was modified 1 year, 1 month ago by chrisames.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sébastien Dumont

    (@sebd86)

    You may want to look at using the Postman interceptor.

    Please know that CoCart v4 once released will not be using Cookies via the REST API.

    Thread Starter chrisames

    (@chrisames)

    Thanks, this is not showing me any cookies for my domain, just a request to admin-ajax.php – confused. It’s weird because I did have it working two days ago.

    Thread Starter chrisames

    (@chrisames)

    Just found the cookies link in bottom right of Postman. There is the woocommerce_items_in_cart cookie, the wp_cocart_session_ and the woocommerce_cart_hash.

    So can I assume that even though Postman response status is 200 OK, this doesn’t mean that Woocommerce is getting it’s data from the correct endpoint or the endpoint isnt being updated by the correct cookie?

    • This reply was modified 1 year, 1 month ago by chrisames.
    • This reply was modified 1 year, 1 month ago by chrisames.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding to cart issues or session issues?’ is closed to new replies.