Fix a wrong cart total in a small React + TypeScript app

$10-30 USD

$10-30 USD

Paid on delivery

I have a small React + TypeScript cart page (Vite, Vitest tests). It has one bug that I need fixed properly. THE BUG The order summary shows a wrong Total when an item has a quantity above 1. The line totals in the list are right ($24.00 + $13.00 + $42.75 = $79.75), but the Total says $44.75, and it does not change when I press + or -. See the attached screenshot. WHAT I NEED - Find the cause and fix it at the source. - Add one automated test that fails before your fix and passes after it. - Keep the change focused: no refactoring, restyling or dependency changes. ACCEPTANCE CRITERIA - The Total always equals the sum of the line totals: on load and after +, - and Remove. - An empty cart shows $0.00. - npm run check passes (lint, format check, type check, tests, build). - The sample data and the existing tests are not edited to make things pass. DELIVERABLES - A zip of the project without node_modules, or a patch file, sent here in chat. - A note of 2-3 sentences: the cause, what you changed, how you tested it. HOW IT WORKS - I send the source code (a small zip) in chat to the developer I award. It includes a README and a [login to view URL] with exact steps and the expected numbers. - It runs locally with Node.js 22. No back end, accounts or external services are needed. - This is a small task: about 30 minutes for someone comfortable with React and TypeScript. Fixed price: $10, paid by milestone as soon as the fix meets the criteria above. Delivery within 24 hours after you receive the files. - Questions are welcome before you start. I reply within one business day. IN YOUR BID Tell me in one or two sentences where you would look first and how you would prove that your fix works. Copy-paste bids will be skipped. This is a small first task. People who deliver clean, tested work get repeat work from me.

Project ID: 40816957

About the project

138 proposals

Remote project

Active 1 min ago

Looking to make some money?

Email address

Benefits of bidding on Freelancer

Set your budget and timeframe

It's free to sign up and bid on jobs

138 freelancers are bidding on average $21 USD for this job

User Avatar
Flag of PAKISTAN

Hello, I can fix this focused React and TypeScript cart-total bug without changing the existing sample data, styling, or dependencies. I would first inspect where the order summary calculates Total versus the line-item quantity totals, then trace the +, -, and Remove state updates to identify the source of the stale or incorrect value. I would prove the fix by adding a regression test that fails before the change and passes afterward, covering quantities above one and verifying the empty-cart result. I will also run npm run check and provide the requested patch or clean zip with a concise cause-and-testing note. Regards Muhammad

User Avatar
Flag of PAKISTAN

I'd look first at where the Total is calculated: a total that ignores quantity and doesn't react to + and - usually means it adds unit prices instead of price x quantity, and is computed once (a useMemo or useState with stale dependencies) instead of being derived from the current cart items. I'd prove it with a Vitest test that renders the cart, raises a quantity and checks the Total equals the sum of the line totals. It fails before the fix and passes after, then npm run check passes clean. $10, delivered within 24 hours of getting the zip.

User Avatar
Flag of PAKISTAN

Hello, I would first trace how the cart derives its summary total versus the per-line quantity calculations, then correct the source of the mismatch without changing unrelated code. I would add a focused Vitest case covering quantity greater than one, run the existing suite, and verify npm run check passes, including the empty-cart and +, -, and Remove scenarios. I will also provide the requested concise cause, change, and testing note with the patch or cleaned project archive. Regards,

User Avatar
Flag of PAKISTAN

Hi there, You need the cart total to reflect accurate sums, especially when item quantities increase, and that’s crucial for a seamless user experience. Fixing this bug while adhering to your constraints is straightforward for me. How I would approach it: - Investigate the current total calculation logic to pinpoint where it breaks with quantities above 1. - Modify the calculation so that the Total updates correctly based on line totals after quantity adjustments. - Implement an automated test that ensures the Total always matches the line totals. - Verify that npm run check passes without any other edits to ensure stability. I have extensive experience with React and TypeScript, and I focus on clean, tested code with thorough documentation. I’ve encountered similar issues previously and delivered fixes that met precise requirements. Which specific part of the calculation logic do you suspect might be causing the issue? I look forward to helping fix this correctly.

User Avatar
Flag of UKRAINE

Hello, I would first check how the order summary calculates the Total. In particular, I’d investigate why the line totals correctly add up to $79.75 while the displayed Total remains $44.75 and does not change when pressing + or -. I will trace the quantity and Remove handlers, fix the calculation at its source, and add a regression test that reproduces the issue before the fix and passes afterward. Deliverables will include a clean project ZIP or a focused patch, plus a short note explaining the cause, fix and verification. I will run the full "npm run check" without modifying the sample data or existing tests.

User Avatar
Flag of PAKISTAN

Hi, The Total not updating (and starting wrong only when quantity > 1) usually comes from a derived total computed from the wrong field or stale memo/update logic. I would first inspect the cart total calculation and the reducer/selectors feeding the order summary, then trace the +/−/Remove handlers to confirm the same source of truth is used everywhere. - Fix the Total at the source so it always equals the sum of visible line totals. - Add a focused automated test that reproduces the bad $44.75 case and verifies it becomes correct after +/− and Remove. - Run the full npm run check suite (lint, typecheck, tests, build) to meet your criteria. I’ll send a zip/patch plus a short 2-3 sentence note with cause, change, and test proof. Regards, Umer Hayat

User Avatar
Flag of PAKISTAN

I would first inspect the cart’s total calculation and state updates to identify why quantity changes and removals are not reflected in the order summary. I’ll fix the calculation at its source, add a regression test covering quantity changes and cart updates, and run `npm run check` to verify everything passes without unnecessary changes. Best Regards, Muhammad

User Avatar
Flag of SERBIA

Hi, I've debugged cart calculation issues in React before—the problem is usually in how the total is computed versus how line items are summed, often a stale closure or missing dependency in a useEffect. I'll start by checking the total calculation logic against the line item array, then trace through the state updates on quantity changes to find where the disconnect is. I'll write a test that reproduces the bug (total not matching sum of line items after quantity change), verify it fails, apply the minimal fix to the calculation or dependency chain, and confirm the test passes along with all existing tests and lint checks. The fix stays focused: no refactoring, no test data changes, just the source of the bug and a test to prevent regression. I can start immediately and will send the fixed code with a clear note on what caused it and how I verified the fix.

User Avatar
Flag of PAKISTAN

Hi there, You need to resolve a cart total discrepancy in your React + TypeScript application, specifically ensuring that the total always reflects the sum of the line items. This type of debugging is well within my expertise, having spent 8 years working extensively with React and TypeScript. How I would approach it: I will first inspect the state management and calculation logic that updates the total. I will then identify the precise cause of the incorrect total. After fixing it, I will create an automated test that verifies the total updates correctly with any item adjustments or removals. At handover, you will receive the adjusted code, and a concise note explaining the fix and test results will be included. Additionally, could you clarify if there are any specific precautions you'd like me to consider while addressing this issue? You can expect a thorough and validated fix that meets your criteria.

User Avatar
Flag of INDIA

I’d first check how the order summary calculates the Total, particularly whether it ignores item quantities or uses a stale value instead of recalculating from the cart state. I’ll fix the root cause, add a Vitest regression test covering quantity changes and removal, and verify everything with `npm run check`. I’m comfortable with your $10 budget and 24-hour deadline.

User Avatar
Flag of BANGLADESH

Hi there, I’d first check how the Total is calculated and whether it uses stale or separately stored cart state instead of the current line items. I’ll fix the calculation at its source and add a regression test covering quantity changes, removal, and an empty cart, then run "npm run check" to verify everything. Best Regards, Avinash

User Avatar
Flag of PAKISTAN

Hi there, A Total of $44.75 against line totals that add up to $79.75 suggests the summary is reading one item's value instead of summing the whole cart, so that is where I would look first. I would trace where the Total is calculated and check whether it uses each item's quantity and line total or only part of that data. I would fix the calculation at that source so the summary is derived from the cart state and updates on load, on +, on - and on Remove, with an empty cart showing $0.00. To prove the fix, I would add one Vitest case that loads the sample cart and asserts the Total equals the sum of the line totals, confirm it fails before the change, then run npm run check end to end. Does the Total read the item price or the line total today, and is there any other place that stores a copy of the sum? If you send the zip, I can get started right away. Feel free to message me.

User Avatar
Flag of TUNISIA

Your screenshot shows the cause: $44.75 is exactly $24.00 + $6.50 + $14.25, the three unit prices added once each. The Total sums price without multiplying by quantity, which is why + and - never move it. The Items count beside it does use quantity, so only the total calculation is wrong. Where I'd look first: the function or useMemo behind the order summary total, and its dependency list in case it is also cached from the initial data. The fix belongs there: price x quantity from the same cart state the list renders. No refactor, no restyling, no dependency changes. Proof: one Vitest test that renders the cart and asserts Total equals the sum of line totals on load ($79.75), after + ($94.00), after - and Remove, and $0.00 when empty. It fails before the fix and passes after, then npm run check on Node 22. Delivered within a few hours of receiving the zip, with the short note.

User Avatar
Flag of ALBANIA

I would first trace how the order-summary Total is derived from cart state, especially quantity changes and any stale memoized value. I would add a Vitest regression covering the $79.75 example, +/−, Remove, and the empty cart, then run npm run check without changing sample data or unrelated code.

User Avatar
Flag of UNITED STATES

Hi - Adelman here. The cart total is likely using stale state or calculating from the wrong quantity data. I'd first trace the quantity update handlers and the order-summary calculation to find where the total stops matching the line items. Then I'd fix the calculation at its source and add a Vitest regression test covering quantities above 1 and the expected total. I'd also verify +, -, Remove, and the empty-cart case, then run the full npm run check without changing the sample data or existing tests. Can you share the source ZIP and confirm whether the expected delivery is within 24 hours of receiving it? Looking forward to work with you.

User Avatar
Flag of SERBIA

HELLO, "wrong cart Total" - the summary is not reflecting the current quantities and line totals when the cart changes. I'll first check the total calculation and React state updates, particularly whether the summary uses stale state or excludes quantity multipliers. I'll fix the calculation at its source and add a Vitest regression test covering the supplied $79.75 example, quantity changes, item removal, and an empty cart. I'll keep the patch focused, preserve the existing tests and sample data, and run the complete npm run check before delivery. THANKS

User Avatar
Flag of PAKISTAN

Hello, I’d first inspect the cart total calculation in the React/TypeScript state or selector logic, since the line totals are correct but the final Total stays wrong when quantities change. Then I’d add a focused Vitest case that reproduces the mismatch on load and after + / - / Remove, so the fix is proven at the source without touching sample data or existing tests. Once you send the zip, I’ll trace the bug, patch the calculation, and verify it with npm run check. https://www.freelancer.com/u/khadijaamin9 https://www.freelancer.pk/portfolio-items/10415629-website-development https://www.freelancer.pk/portfolio-items/10412229-website-design https://www.freelancer.pk/portfolio-items/10840083-web-banner-design Thanks, Khadija Amin

User Avatar
Flag of VIETNAM

$=== SUPER MATCH ===$ "TOTAL MUST MATCH THE SUM OF LINE TOTALS" — I'd first inspect the cart state and total calculation, especially whether the summary uses stale state or an incorrect quantity aggregation. I'll trace how quantity changes, item removal and cart initialization update the data, then fix the calculation at its source without touching unrelated code. I'll add a Vitest regression test covering quantities above 1 and verify the total after +, -, Remove and an empty cart. I'll also run npm run check to confirm linting, formatting, types, tests and build all pass. You'll receive the focused patch or project ZIP along with a short explanation of the cause and fix within 24 hours of receiving the source files. Looking forward to working with you.

User Avatar
Flag of PAKISTAN

Hi, I’ve reviewed your Fix a wrong cart total in a small React + TypeScript app and understand what you’re looking to achieve. I can help you handle the required work with a clean, reliable, and professional approach. I have experience with PHP, JavaScript, Software Testing, HTML, jQuery / Prototype, Software Development, Typescript, Web Development, Frontend Development, Vite and can work effectively with your existing setup, requirements, and workflow. I’ll focus on proper implementation, responsive functionality, attention to detail, and thorough testing to make sure everything works as expected. I’ll also make sure the completed work is aligned with your requirements rather than just providing a quick or temporary solution. I’m available to start immediately and can work according to your required timeline. Best regards, Khadija Tul Kubra

User Avatar
Flag of UNITED STATES

Hi, I'm Anas, a Preferred Freelancer based in Phoenix, AZ. I can fix the cart total bug in your React + TypeScript Vite app and keep the change tight, testable, and easy to maintain. My approach: 1. Trace the cart total logic and identify whether the issue is in state handling, item quantity/price calculations, or a rendering mismatch. 2. Update the calculation in the smallest safe way, with TypeScript types kept clean and no unnecessary refactor. 3. Run the Vitest suite and add or adjust a focused test so the bug stays fixed. I’m comfortable working in frontend codebases where correctness matters more than broad changes. For a small issue like this, I’ll focus on isolating the root cause, fixing the logic, and verifying the expected total across the relevant cart states. If you want, I can also quickly review nearby cart code for any related edge cases, like quantity updates, removed items, or rounding issues. Quick question: is the wrong total happening on initial load, after updating quantities, or only after removing an item? Looking forward to hearing from you! Best, Anas

内容来自 Freelancer News,版权归原作者所有。

阅读原文 ↗

把喜欢的内容,留在你的新标签页。

打开我的订阅