Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Store-API: After successful checkout with a coupon code for 100% discount the items remain in the cart. #10438

Closed
kodes-agency opened this issue Aug 1, 2023 · 8 comments
Labels
type: bug The issue/PR concerns a confirmed bug. type: community contribution

Comments

@kodes-agency
Copy link

kodes-agency commented Aug 1, 2023

Describe the bug

The bug is evident only when using a coupon code for 100% discount of the cart items. After successful checkout, the item remain in the cart.

I assume that it has to do with the order status. When the order has amount greater than 0, the status is set to "processing". However, if the amount is 0 due to 100& discount coupon, the order status is "completed".

Suggestions

I believe that it's best if the status even after a coupon code for 100% remains "processing" instead of "completed", otherwise it confuses the store managers that receive a new order with the wrong status tag.

@kodes-agency kodes-agency added the type: bug The issue/PR concerns a confirmed bug. label Aug 1, 2023
@kodes-agency kodes-agency changed the title After succefull checkout with a coupon code for 100% discount the items remain in the cart. Store-API: After successful checkout with a coupon code for 100% discount the items remain in the cart. Aug 1, 2023
@wavvves
Copy link
Contributor

wavvves commented Aug 1, 2023

Hi @kodes-agency. Thank you so much for reporting this.
I tried to replicate it without success. My cart was empty after checking out an item with a 100% discount coupon, and the order is shown as "Processing"

image

Can you provide more details for your environment (you can obtain this information in WooCommerce > Status)?
Also, some testing steps, including coupon creation, would be helpful to make sure I'm not missing any configuration that is preventing me from replicating.

Thank you

@kodes-agency
Copy link
Author

kodes-agency commented Aug 1, 2023

Hi @wavvves, thank you for your quick reply!
Unfortunately, I have the most basic setting in regards to the coupon - Add coupon > Discount type - Percentage discount , Coupon amount - 100.

I have tried with different restrictions and limits but the result is all the same.

Screenshot 2023-08-01 at 17 52 19

Here are the environment details:
`

WordPress Environment

WC Version: 7.9.0
REST API Version: ✔ 7.9.0
WC Blocks Version: ✔ 10.4.6
Action Scheduler Version: ✔ 3.6.1
Log Directory Writable: ✔
WP Version: 6.2.2
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: ✔
Language: en_US
External object cache: –

Server Environment

Server Info: nginx/1.18.0
PHP Version: 8.1.2-1ubuntu2.13
PHP Post Max Size: 8 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.81.0
OpenSSL/3.0.2

SUHOSIN Installed: –
MySQL Version: 8.0.33-0ubuntu0.22.04.2
Max Upload Size: 2 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Database

WC Database Version: 7.9.0
WC Database Prefix: wp_
Total Database Size: 5.44MB
Database Data Size: 3.56MB
Database Index Size: 1.88MB
wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_order_itemmeta: Data: 0.09MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_actions: Data: 0.13MB + Index: 0.14MB + Engine InnoDB
wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_logs: Data: 0.09MB + Index: 0.09MB + Engine InnoDB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_comments: Data: 0.05MB + Index: 0.09MB + Engine InnoDB
wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_options: Data: 2.05MB + Index: 0.06MB + Engine InnoDB
wp_postmeta: Data: 0.16MB + Index: 0.17MB + Engine InnoDB
wp_posts: Data: 0.05MB + Index: 0.06MB + Engine InnoDB
wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_admin_note_actions: Data: 0.06MB + Index: 0.02MB + Engine InnoDB
wp_wc_admin_notes: Data: 0.08MB + Index: 0.00MB + Engine InnoDB
wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_bundle_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_bundled_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_bundled_items: Data: 0.02MB + Index: 0.03MB + Engine InnoDB

Post Type Counts

acf-field: 1
acf-field-group: 1
attachment: 6
page: 7
post: 2
product: 7
product_variation: 5
shop_coupon: 2
shop_order: 32
wp_global_styles: 1

Security

Secure connection (HTTPS): ✔
Hide errors from visitors: ✔

Active Plugins (1)

WooCommerce: by Automattic – 7.9.0

Inactive Plugins (2)

Advanced Custom Fields: by WP Engine – 6.1.7
WooCommerce Product Bundles: by WooCommerce – 6.22.1

Settings

API Enabled: –
Force SSL: –
Currency: BGN (лв.)
Currency Position: right_space
Thousand Separator:
Decimal Separator: ,
Number of Decimals: 2
Taxonomies: Product Types: bundle (bundle)
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)

Connected to WooCommerce.com: –
Enforce Approved Product Download Directories: ✔
HPOS feature screen enabled: –
HPOS feature enabled: –
Order datastore: WC_Order_Data_Store_CPT
HPOS data sync enabled: –

WC Pages

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

Theme

Name: Twenty Twenty-Two
Version: 1.4
Author URL: https://wordpress.org/
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: –

Admin

Enabled Features: activity-panels
analytics
product-block-editor
coupons
core-profiler
customer-effort-score-tracks
import-products-task
experimental-fashion-sample-products
shipping-smart-defaults
shipping-setting-tour
homescreen
marketing
mobile-app-banner
navigation
onboarding
onboarding-tasks
remote-inbox-notifications
remote-free-extensions
payment-gateway-suggestions
shipping-label-banner
subscriptions
store-alerts
transient-notices
woo-mobile-welcome
wc-pay-promotion
wc-pay-welcome-page

Disabled Features: minified-js
new-product-management-experience
product-variation-management
settings
async-product-editor-category-field

Daily Cron: ✔ Next scheduled: 2023-08-02 11:55:28 +03:00
Options: ✔
Notes: 88
Onboarding: completed

Action Scheduler

Complete: 322
Oldest: 2023-07-02 00:47:20 +0300
Newest: 2023-08-01 16:47:12 +0300

Failed: 2
Oldest: 2023-06-19 14:21:32 +0300
Newest: 2023-06-20 17:33:08 +0300

Pending: 1
Oldest: 2023-08-02 13:24:29 +0300
Newest: 2023-08-02 13:24:29 +0300

Status report information

Generated at: 2023-08-01 17:34:44 +03:00
`

@nielslange
Copy link
Member

Thanks for providing the environment details and the steps on how you created the coupon. Unfortunately, I'm still unable to reproduce this issue. Could you please double-check if you see the same issue on a fresh WordPress site? Meanwhile, I'll ask my colleagues if one of them can reproduce this issue.

@kodes-agency
Copy link
Author

Hey there! I will try to replicate it on a fresh copy as soon as possible and I will get back to you with the results.

@nielslange
Copy link
Member

My colleagues also looked into this issue and @roykho pointed out that virtual products immediately show the status completed instead of processing as virtual products do not require shipping. Is it possible that you ran into this issue using a virtual product?

@kodes-agency
Copy link
Author

Unfortunately, the products are just "simple products".

As suggested, I have tried to replicate the issue, and it persists. I created a brand new WordPress instance with only WooCommerce installed.

On the image bellow you can see the response in Insomnia, with a status "completed". If you want you can send a request to the same store that I used, and see if you get the same response. The coupon code is "free-code". I can also provide you with the credentials for this test instance.

Screenshot 2023-08-10 at 16 30 32

@tarunvijwani
Copy link

@kodes-agency Sorry for the delayed response. I'm unable to reproduce the issue. It would be helpful if you could replicate this on one of your test instances and share its credentials.

Also, is this happen only Cart and Checkout block pages? Could you please try reproducing the problem with the shortcode(legacy) Checkout and let us know?

Looking forward to hearing back from you.

@mikejolley
Copy link
Member

I believe that it's best if the status even after a coupon code for 100% remains "processing" instead of "completed", otherwise it confuses the store managers that receive a new order with the wrong status tag.

It uses processing if the order "needs_processing"—in this case it will use processing if the order contains a simple product that needs shipping. If the order contains only virtual products it will be completed.

Unless an extension modifies this behaviour.

As for clearing the cart, it happens when the order received page is shown. If you make the request via the API, the cart contains won't be cleared automatically.

Having gone through the checkout process with the 100% coupon I also cannot reproduce the issue, and since its been 2 weeks I will close this out.

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug The issue/PR concerns a confirmed bug. type: community contribution
Projects
None yet
Development

No branches or pull requests

5 participants