PaymentModule - Multiple Orders for a Cart
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 136
- Forks
- 555
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 4
Description
Sometime PrestaShop will split a Cart in multiple Order with same Reference after a Payment.
This is made in PaymentModule::validateOrder()
Because this splitting is made by PrestaShop after the Payment, Customer has only paid Shipping Costs for one Order.
So PrestaShop will display a warning on Order view page to notify merchant the total order amount is not equal to total cart amount.
PrestaShop will send to PaymentModule only Order id and Order reference of the last created Order.
Every PaymentModule will only update OrderState of the last created Order, on module validation trigger by API (like bank validation return).
Every child Order should be manually update by merchant because he needs to choose if additional shipping cost should be paid by Customer or if he take it in charge.
⚠️ Possible cases :
- A product of Cart exceeds the price/weight range of carriers
- A product of Cart is restricted to one Carrier (case described bellow)
- Warehouse management in 1.6, removed in 1.7
- Multi-shipping functionnality in 1.5 removed in 1.6
- Others cases I don't know
➡️ Need more informations to find every possible cases will cause Order splitting and how to handle that for Module developer.
How to test
Case : A product of Cart is restricted to one Carrier
- Install a fresh PrestaShop instance
- Install PrestaShop Checkout module or another Payment module require validation from an API
- Go to BO > Sell > Catalog > Products
- Edit Product 1 aka
Hummingbird printed t-shirt - In Shipping tab > Available carriers > check case of
PrestaShop (Pick up in-store) - Save product
- Edit Product 2 aka
Hummingbird printed sweater - In Shipping tab > Available carriers > check case of
My carrier (Delivery next day!) - Save product
- Go to Shop
- Go to product page of Product 1 aka
Hummingbird printed t-shirt - Add to cart
- Go to product page of Product 2 aka
Hummingbird printed sweater - Add to cart
- Go to Cart page
- Go to Proceed to checkout
- Choose to paid with PrestaShop Checkout
- Paid
- See
Your order hasn't been validated yet, only created. There can be an issue with your payment or it can be captured later, please contact our customer service to have more details about it. - Go to BO > Sell > Orders
- See 2 Orders created with same reference, only one is with status
Payment accepted - View this Orders and see
Warning €[TOTAL ORDER] paid instead of €[TOTAL CART]. This warning also concerns order [Order reference]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with classes/PaymentModule.php, especially PaymentModule::validateOrder() and the cited order ID, reference, and last-created-order locations. Reproduce the carrier-restriction case using the listed checkout and back-office steps, then investigate the other described splitting cases. Done means documenting the causes and the handling implications for payment-module developers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation, payments
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100