Closed HBaz92 closed 2 years ago
Hi @HBaz92 ,
While our goal is to address all the issues reported in this repository, GitHub should be treated as a place to report WooCommerce bugs only.
You checked the checklist item that you have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active however you also mentioned this happens with WooCommerce Smart Coupons Plugin by StoreApps and your system status reports mentions 58 other active plugins.
Can you please confirm if you performed initial troubleshooting such as testing for theme and plugins conflict on your site? To do that, you’d need to deactivate all plugins except for WooCommerce and switch the default theme such as Storefront. Then test again.
To us evaluate this issue can you also confirm which WC API endpoint are you using (including the version e.g. /wp-json/wc/v3/products)?
Prerequisites (mark completed items with an [x]):
Describe the bug im using smart coupon plugin from woocommerc and when i add rules For example like max discount its not apply through api ..The order is created through api but does not comply to any rules i had set it on it......
Expected behavior & Actual behavior i create coupon "Dis10" and the discount_type is : "Percentage discount" 10% with max discount 10$...after that i create the order from api and i put the coupon "Dis10".... and the total of basket is 150$ ...the final total should be 140$ after apply coupon ...but instead i get final total 135$ ?!!!
Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.) Steps to reproduce the bug: 1. Create new Coupon With discount_type : "Percentage discount" with value of 10% and max discount 10$.
2. and this is the details of the coupon that i created :
3- create order from api postman as following in api body : POST API : https://xxxx.com/wp-json/wc/v3/orders?consumer_key=ck_9e7738ee85eXXXXXX&consumer_secret=cs_0dd3bb39XXXXXX
4- create order from api postman as following in api get info : GET API : https://xxxx.com/wp-json/wc/v3/orders/27?consumer_key=ck_9e7738ee85eXXXXXX&consumer_secret=cs_0dd3bb39XXXXXX
5-the Final total shows wrong as 135$ ...and its should be 140$ .
Isolating the problem (mark completed items with an [x]):
WordPress Environment
Hello @HBaz92,
I tested this on my local site, but could not replicate the same behavior.
This is the request I sent:
{
"payment_method": "bacs",
"payment_method_title": "Direct Bank Transfer",
"set_paid": true,
"discount_total": "5.50",
"discount_tax": "0.00",
"shipping_total": "10.00",
"shipping_tax": "0.00",
"cart_tax": "0.00",
"total": "59.50",
"billing": {
"first_name": "John",
"last_name": "Doe",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US",
"email": "john.doe@example.com",
"phone": "(555) 555-5555"
},
"shipping": {
"first_name": "John",
"last_name": "Doe",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US"
},
"line_items": [
{
"product_id": 2286,
"quantity": 2,
"variation_id": 0,
"quantity": 1,
"tax_class": "",
"subtotal": "55.00",
"subtotal_tax": "0.00",
"total": "49.50",
"total_tax": "0.00",
"taxes": [],
"sku": "woo-belt",
"price": 49.5
}
],
"shipping_lines": [
{
"method_id": "flat_rate",
"method_title": "Flat Rate",
"total": "10.00"
}
],
"coupon_lines": [
{
"code": "test"
}
]
}
Here's my coupon setup:
The response I received:
{
"id": 3862,
"parent_id": 0,
"status": "processing",
"currency": "USD",
"version": "6.0.0",
"prices_include_tax": false,
"date_created": "2021-12-18T11:36:39",
"date_modified": "2021-12-18T11:36:39",
"discount_total": "5.50",
"discount_tax": "0.00",
"shipping_total": "10.00",
"shipping_tax": "0.00",
"cart_tax": "0.00",
"total": "59.50",
"total_tax": "0.00",
"customer_id": 0,
"order_key": "wc_order_REDACTED",
"billing": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US",
"email": "john.doe@example.com",
"phone": "(555) 555-5555"
},
"shipping": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US",
"phone": ""
},
"payment_method": "bacs",
"payment_method_title": "Direct Bank Transfer",
"transaction_id": "",
"customer_ip_address": "",
"customer_user_agent": "",
"created_via": "rest-api",
"customer_note": "",
"date_completed": null,
"date_paid": "2021-12-18T11:36:39",
"cart_hash": "",
"number": "3862",
"meta_data": [{
"id": 51347,
"key": "_fue_recorded",
"value": "1"
}, {
"id": 51348,
"key": "_order_status_emails_queued",
"value": "1"
}, {
"id": 51349,
"key": "_new_order_email_sent",
"value": "true"
}],
"line_items": [{
"id": 100428,
"name": "Belt",
"product_id": 2269,
"variation_id": 0,
"quantity": 1,
"tax_class": "",
"subtotal": "55.00",
"subtotal_tax": "0.00",
"total": "49.50",
"total_tax": "0.00",
"taxes": [],
"meta_data": [],
"sku": "woo-belt",
"price": 49.5,
"parent_name": null
}],
"tax_lines": [],
"shipping_lines": [{
"id": 100429,
"method_title": "Flat Rate",
"method_id": "flat_rate",
"instance_id": "",
"total": "10.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": []
}],
"fee_lines": [],
"coupon_lines": [{
"id": 100430,
"code": "test",
"discount": "5.5",
"discount_tax": "0",
"meta_data": []
}],
"refunds": [],
"date_created_gmt": "2021-12-18T11:36:39",
"date_modified_gmt": "2021-12-18T11:36:39",
"date_completed_gmt": null,
"date_paid_gmt": "2021-12-18T11:36:39",
"currency_symbol": "$",
"_links": {
"self": [{
"href": "https:\/\/REDACTED\/wp-json\/wc\/v3\/orders\/3862"
}],
"collection": [{
"href": "https:\/\/REDACTED\/wp-json\/wc\/v3\/orders"
}]
}
}
Screenshot of the order:
If you're only seeing this behavior with Smart Coupons enabled / for help with configuring the coupons using that extension, or to report bugs about the same, please reach out to the developers for the plugin directly at https://woocommerce.com/my-account/create-a-ticket/?form=ticket and select Smart Coupons
under I need help with
(you can view the plugin in the list once you log-in to the account where you purchased the extension).
I'm closing this ticket for now as it seems the issue is not related to core WooCommerce coupons.
If you can still replicate the issue under conflict testing conditions with just WooCommerce as the active plugin and Storefront Theme as the active theme, can we please request you to get back to us with the exact steps to replicate under conflict testing conditions?
Yes, Seems "Maximum Discount" is coming from Smart Coupons. But WC also should support it also because I see here a lot of coupons system are using it.
For example:
Coupon settings
General:
Discount type: Percentage discount Coupon amount: 10% Maximum Discount: 20$
When the user add to cart and total is 450$, then currently when apply the coupon, the discount amout is $45 (10%). It should $20 as I set maximum Discount.
Prerequisites (mark completed items with an [x]):
Describe the bug im using smart coupon plugin from woocommerc and when i add rules For example like max discount its not apply through api ..The order is created through api but does not comply to any rules i had set it on it......
Expected behavior & Actual behavior i create coupon "Dis10" and the discount_type is : "Percentage discount" 10% with max discount 10$...after that i create the order from api and i put the coupon "Dis10".... and the total of basket is 150$ ...the final total should be 140$ after apply coupon ...but instead i get final total 135$ ?!!!
Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.) Steps to reproduce the bug:
3- create order from api postman as following in api body:
4-the Final total shows wrong as 135$ ...and its should be 140$ .
Screenshots
Isolating the problem (mark completed items with an [x]):
WordPress Environment