Git Product home page Git Product logo

Comments (25)

seb86 avatar seb86 commented on May 22, 2024

When you say the delete request was SUCCESS with status 500 does that mean it is deleting the item but still returns an error response?

from co-cart.

Janie20 avatar Janie20 commented on May 22, 2024

@seb86 Sorry for my english and No it did not delete the item in the cart.

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

OK I will look into the issue. Could you please provide me with your WooCommerce system status report. Thank you.

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

@Janie20 I have not been able to replicate your issue. I was able to remove an item using Postman with no problems.

Did you add the item via Postman first or did you add the item via the site first then try to remove it via Postman because it can not see your browser session?

Steps I took to remove item in Postman.

  1. View cart - cart is empty
  2. Add an item - cart returned with item
  3. View cart - cart returns with item
  4. Delete item - item is removed
  5. View cart - cart is empty

from co-cart.

Janie20 avatar Janie20 commented on May 22, 2024

I did the same steps that you took , but i would still get the error on step 4.
I'm new to woocommerce , is this the system report you are looking for ?
`

WordPress Environment

Home URL: http://localhost/wordpress
Site URL: http://localhost/wordpress
WC Version: 3.3.4
Log Directory Writable: ✔
WP Version: 4.9.5
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: ✔
Language: en_US

Server Environment

Server Info: Apache/2.2.32 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.1.8 mod_ssl/2.2.32 OpenSSL/1.0.2j DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.24.0
PHP Version: 7.1.8
PHP Post Max Size: 32 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.52.1
OpenSSL/1.0.2j

SUHOSIN Installed: –
MySQL Version: 5.6.35
Max Upload Size: 32 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Database

WC Database Version: 3.3.4
WC Database Prefix: wp_
MaxMind GeoIP Database: ✔
Total Database Size: 2.68MB
Database Data Size: 1.81MB
Database Index Size: 0.87MB
wp_woocommerce_sessions: Data: 0.17MB + Index: 0.02MB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB
wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB
wp_comments: Data: 0.02MB + Index: 0.09MB
wp_links: Data: 0.02MB + Index: 0.02MB
wp_options: Data: 1.05MB + Index: 0.02MB
wp_postmeta: Data: 0.05MB + Index: 0.03MB
wp_posts: Data: 0.02MB + Index: 0.06MB
wp_termmeta: Data: 0.02MB + Index: 0.03MB
wp_terms: Data: 0.02MB + Index: 0.03MB
wp_term_relationships: Data: 0.02MB + Index: 0.02MB
wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB
wp_usermeta: Data: 0.02MB + Index: 0.03MB
wp_users: Data: 0.02MB + Index: 0.05MB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB
wp_yoast_seo_links: Data: 0.02MB + Index: 0.02MB
wp_yoast_seo_meta: Data: 0.02MB + Index: 0.00MB

Post Type Counts

attachment: 3
customize_changeset: 2
nav_menu_item: 10
page: 8
post: 1
product: 2
revision: 5
shop_order: 3

Security

Secure connection (HTTPS): ❌Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
Hide errors from visitors: ✔

Active Plugins (7)

AiCS ipay88 Woocommerce: by AiCS – 1.1.0 – Not tested with the active version of WooCommerce
Cart REST API for WooCommerce: by Sébastien Dumont – 1.0.2
Ocean Extra: by OceanWP – 1.4.9
WP REST API: by WP REST API Team – 2.0-beta15
WooCommerce PayPal Express Checkout Gateway: by WooCommerce – 1.5.1
WooCommerce: by Automattic – 3.3.4 – 3.3.5 is available
WP BASIC Auth: by wokamoto – 1.1.3

Settings

API Enabled: ✔
Force SSL: –
Currency: MYR (RM)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)

WC Pages

Shop base: #4 - /
Cart: #5 - /cart/
Checkout: #6 - /checkout/
My account: #7 - /my-account/
Terms and conditions: ❌ Page not set

Theme

Name: OceanWP
Version: 1.5.9 – 1.5.10 is available
Author URL: https://oceanwp.org/about-me/
Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme
WooCommerce Support: ✔

Templates

Overrides: oceanwp/woocommerce/cart/mini-cart.php
oceanwp/woocommerce/loop/loop-start.php
oceanwp/woocommerce/single-product/title.php

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

Thank you for sharing your system report. Can you tell me why you have WP REST API installed? It's already part of WordPress. That could be causing some issues. Please disable it and try again.

from co-cart.

Janie20 avatar Janie20 commented on May 22, 2024

I deactivated it and try again , but still getting the same error result.

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

Are you using authentication when removing the item?

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

Can you make sure the item key is also correct.

from co-cart.

Janie20 avatar Janie20 commented on May 22, 2024

No, I'm not using authentication, when removing the item. I make sure my cart is not empty as you can see in the first picture , then I tried to remove the item , I only put the cart_item_key on the body.
I can't figure out where I'm wrong , am I missing any steps here ? Really appreciate your help !

screen shot 2018-04-12 at 9 17 42 am

screen shot 2018-04-12 at 9 16 15 am

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

I see what you are doing now. You are adding the cart_item_key as form-data when you should be adding it to the parameters. Clear the form-data and click on "Params" next to the big blue "Send" button.

Then add the key and value there. Then press "Send".

from co-cart.

Janie20 avatar Janie20 commented on May 22, 2024

Oh, I did not know that , I tried what you suggest and this is my result.
screen shot 2018-04-12 at 11 24 51 am

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

Can you disable all plugins execpt for WooCommerce and the Cart REST API and try again after refreshing your permalinks to flush the rewrite rules please.

from co-cart.

Janie20 avatar Janie20 commented on May 22, 2024

still not working ...

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

Then the only thing I can think of is that there is something wrong with your Postman software because you should only get that error if the cart_item_key is not added as a parameter which you have done.

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

Are you able to run the same tests with your site online?

from co-cart.

Janie20 avatar Janie20 commented on May 22, 2024

You mean publish my website on the internet ?

I used ngrok to run my site and repeat the steps ( with only two plugin activated which is the Cart REST API and WooCommerce , sadly I'm still getting the same result.

This is the screenshot capture on the ngrok terminal
screen shot 2018-04-12 at 1 30 54 pm

screen shot 2018-04-12 at 1 37 26 pm

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

This is so weird. If the body is used to apply cart_item_key with form-data set it does not send the item key as a string so reports the error.

If posted with x-www-form-urlencoded set, it works.

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

But the best option is still to use the "Params" to apply the cart_item_key. Works every time for me so what I would like you to do is the following:

  1. View Cart - (GET) https://sebdumont.xyz/dev/wp-json/wc/v2/cart - Does it say "Cart is empty!"?
  2. Add Product - (POST) https://sebdumont.xyz/dev/wp-json/wc/v2/cart/add?product_id=60 - Does it return item data in the body response?
  3. Do step 1 again to make sure the product was added.
  4. Remove Product - (DELETE) https://sebdumont.xyz/dev/wp-json/wc/v2/cart/cart-item?cart_item_key=072b030ba126b2f4b2374f342be9ed44 - Does it remove the item?
  5. Do step 1 again to make sure the cart is empty again.

If that fails then I will look further into the issue. I would just like to see what you get after running this test.

Thank you.

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

@Janie20 Let me know when you have run the tests as I asked above. Thank you.

from co-cart.

Janie20 avatar Janie20 commented on May 22, 2024

@seb86 I have founded whats the problem that causing the error , it turns out to be the cart item key that I get was the reason causing the error. I'm not sure if this is the main reason, but it works perfectly fine after I done some configuration on my site, then I go create a new product , and the key that generated become slightly different as I realize the key generated now start with a number instead of an alphabet like my previous cart item key. Now it works perfectly fine. Thank you for answering my question , really appreciate the help ^_^

previous = "c16a5320fa475530d9583c34fd356ef5"
now = "9f61408e3afb633e50cdf1b20de6f466"

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

@Janie20 Can you tell me what configurations you made to your site that you think helped fix the issue?

If the issue is with the cart item key starting with a letter rather than a number then that will need to be confirmed.

Do all your products item key start with a letter or number? I will comfirm on my end to see if that is the case. So far no one else has reported this issue.

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

I can confirm that products cart_item_key can start with a letter or number. When it starts with a letter it is unable to validate the value not being a 0. See line 362-364 on removing an item.

I will change this validation and put out a release soon.

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

The same validation will be applied to restoring and updating an item.

from co-cart.

seb86 avatar seb86 commented on May 22, 2024

OK I have pushed changes @Janie20.

Can you download the update and run your tests again please to confirm.

Let me know if the issue is resolved afterwards. Thank you.

from co-cart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.