lunar icon indicating copy to clipboard operation
lunar copied to clipboard

Fix line fetching in order creation

Open maurice-ellis opened this issue 1 year ago • 3 comments

I'm updating the line fetching in Lunar\Pipelines\Order\Creation\CreateOrderLines and Lunar\Pipelines\Order\Creation\MapDiscountBreakdown to match the one used in Lunar\Actions\Carts\GetExistingCartLine to see if the line meta matches as well.

This PR will help be able to handle products when similar products are added instead of merged and quantity updated.

maurice-ellis avatar Sep 17 '24 21:09 maurice-ellis

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 30, 2025 0:39am

vercel[bot] avatar Sep 17 '24 21:09 vercel[bot]

Thanks @maurice-ellis Are you able to provide a test case to show what this is fixing within it's context?

alecritson avatar Sep 18 '24 10:09 alecritson

@alecritson I added a test case. I believe I did that correctly.

The issue is when you have 2 of the same purchasables, it causes an undefined key error in generating the breakdown because the line does not exist because the $cartLinesMappedToOrderLines only had one order line. By comparing the meta as well, it generates 2 separate lines and the error is resolved.

Not sure how to exactly test for that, but did create a case.

maurice-ellis avatar Sep 18 '24 19:09 maurice-ellis