-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
woocommerce order totals wont update when adding fee #26543
woocommerce order totals wont update when adding fee #26543
Comments
Hi @erikdemarco, Thank you for submitting the issue. However, you didn’t fill out the details of the bug report template that we ask for. Without these details, we can’t fully evaluate this issue. Please provide us with the information requested, especially the expected behavior, so we could take a look further. Describe the bug To Reproduce
Screenshots Expected behavior Isolating the problem (mark completed items with an [x]):
WordPress Environment
```
Copy and paste the system status report from **WooCommerce > System Status** in WordPress admin.
```
|
Describe the bug To Reproduce
Screenshots Expected behavior Isolating the problem (mark completed items with an [x]):
WordPress Environment
```
`
### WordPress Environment ###
WordPress address (URL): https://xxxxx.com Server EnvironmentServer Info: Apache/2.4.29 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.1.1g SUHOSIN Installed: – DatabaseWC Database Version: 4.1.1 Post Type Counts_pods_field: 1 SecuritySecure connection (HTTPS): ✔ Active Plugins (12)Adminimize: by Frank Bültge – 1.11.6 Inactive Plugins (5)Advanced Shipment Tracking for WooCommerce: by zorem – 2.9.9.4 – Installed version not tested with active version of WooCommerce 4.1.1 SettingsAPI Enabled: – Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) Connected to WooCommerce.com: – WC PagesShop base: #6 - /shop/ ThemeName: Storefront Child Theme TemplatesOverrides: – Action SchedulerComplete: 107 Pending: 1 `
|
@jonathansadowski im pretty sure 90% its a bug. I have tried every possible combination this past 5days with no success. here's what i found: here's my newest code, this code works flawlessly when order created via frontend (checkout) and via backend (add order from admin panel). But when order created via restapi. the order totals is never gets updated (wrong value).
|
Sorry for the delay in response, @erikdemarco . We'll try to reproduce on our end and assign correct priority. |
The test code worked for me. REST response from POSTing the order
POST body
@erikdemarco I'll close the issue. If you can provide steps to reproduce we will be happy to reopen. |
@erikdemarco Sorry, I missed that the order totals don't show the amounts. If I click the recalculate button is does include the shipping. |
Hi @rrennick this is exactly the problem. Please see your posted screenshot once again. Product total: $9 So the order total should be $105. In your screenshot the order total shows wrong value ($59) |
Right, if you click recalculate the total is updated and correct. The issue is it should be correct without needing to have that button click. |
Hey ! I'd like to pick this one up for contributor's day 2023. |
Hey team, been collaborating with @alexiglesias31 here on the issue for the past couple hours, and even tho the PR #37845 does fix the issue for the code posted here, there seems to be an issue (or several) with how the I believe the underlying problem should be addressed. Let me elaborate. BackgroundWhenever ResearchRegular CheckoutThis is the baseline for how the order should be created. Most of the calculations are done in the WC_Cart class, and then transferred over. No calculations are done on the WC_Order object. There's no calls to As explained on the issue, the code works under these circumstances. Admin Created OrderThere's a difference here between HPOS and CPT data stores. CPT: Creates the order as autodraft. Code calls This is our first inconsistence here.. Semantically, I believe HPOS: From the moment you open the order editor, Second problem here.. REST API Created OrderNow here the object is created with a pending status (with CPT Data Store), and
Third problem here. Again, ConclusionAll of these inconsistencies about how the IMO this hook should be called right after the order is created in a "finished" state based on wherever it got the input.
This requires refactors in a lot of places that we couldn't get to in the allocated timeframe for the contributor day. But hopefully this shed some light into the issue as far as the underlying reason why this happen. To think about all the implications of making the changes mentioned here in this post is something that would take a lot of time. |
I have this hook:
When order created via frontend and backend, its working properly.
But when order is created via REST API. The order-total is not correct. and get_shipping_total() become 0
The text was updated successfully, but these errors were encountered: