• Resolved moderncaliber

    (@moderncaliber)


    Products are not getting removed from my cart when I use the delete call on the CoCart API. Here are my steps.

    Here is the cart hash and key from when I get /wp-json/cocart/v2/cart. (I do have products in my cart for reference that do show up in the get request)

    1. cart_hash: “4f1449ea3d4f1f64b11dd14e933b299f”
    2. cart_key: “1”

    And here is the response I get when I delete a product

    1. cart_hash: “No items in cart so no hash”
    2. cart_key: “1”

    So i do have products in my cart, but the response when I try to delete it says i don’t. But the other functions like update line item do work. What is going on here?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Sébastien Dumont

    (@sebd86)

    @moderncaliber Your clearly authenticating. Mind sharing which authentication method your using so we can try and replicate the issue?

    Thread Starter moderncaliber

    (@moderncaliber)

    JWT Authentication for the WordPress REST API. So I’m storing a token and then authenticating with that. Here is my code. But for now I have switched to only using CoCart for adding products to the cart, and redirecting to the WooCommerce cart itself instead of building a cart with NextJS and CoCart

    // Set up the Authorization header with the Bearer token
    const config = {
    headers: { Authorization:
    Bearer ${token} },
    }

    const response = await axios.delete(
    ${process.env.NEXT_PUBLIC_URL}/wp-json/cocart/v2/cart/item/${itemKey},
    config
    )
    Plugin Author Sébastien Dumont

    (@sebd86)

    The issue is being worked on @moderncaliber You can follow this issue for further updates or join in the conversation.

    Plugin Author Sébastien Dumont

    (@sebd86)

    @moderncaliber Patch v4.3.14 now released to solve this issue. Thank you for reporting.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.