This is a follow-up to #2968079: Prevent exceptions on checkout page when order_total is null, which was already committed.

There is one more place that needs to be updated to prevent exceptions in checkout when order total is null.

CommentFileSizeAuthor
#2 3204694-2.patch755 byteszengenuity

Comments

zengenuity created an issue. See original summary.

zengenuity’s picture

StatusFileSize
new755 bytes

Patch attached

zengenuity’s picture

Status: Active » Needs review
geek-merlin’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community
Issue tags: +Contributed project blocker
Related issues: +#2968079: Prevent exceptions on checkout page when order_total is null

I bumped into this very same problem with a custom module.
Setting major because the project page says it blocks https://www.drupal.org/project/commerce_admin_checkout
Reviewed the code and can confirm that it trivially prevents the exception mentioned in the IS.
Triggered test again as due diligence.
Can confirm that this just finishes the related predecessor issue.
Setting RTBC based on that.

jsacksick’s picture

Status: Reviewed & tested by the community » Needs work

But I don't consider this fix as legit... How in the world does it make sense to skip payments and allow checkout completion when the order total price is NULL? This is just a malformed order... Order total should be 0 for a free order, not NULL.

geek-merlin’s picture

Status: Needs work » Reviewed & tested by the community

I can tell you my use case: The checkout process is entered with an empty order, and the order is filled there (and never empty on completion). This makes a fantastic UX for a broad range of use cases.
(I tried a lot to do it differently, but all other approaches were quite doomed.)

I suppose the approach in the commerce_admin_checkout module of @zengenuitiy is similar.

Also i thought if you committed the same thing in the predecessor issues:
- #2968079: Prevent exceptions on checkout page when order_total is null
- #2964692: Provide way for contrib to override NULL in order total
and if those were good to commit, this should be too.

What u think?

If you changed your mind and say the predecessor issue should never have got committed, i can imagine the following: In the above use case of an order without items, instead of a null price throwing, the order refresh sets a zero price in that case. I can work on that if you prefer.

jsacksick’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks!

  • jsacksick committed 24bd91bf on 8.x-2.x authored by zengenuity
    Issue #3204694 by zengenuity, geek-merlin, jsacksick: Prevent exceptions...

  • jsacksick committed 5f4605e3 on 3.0.x authored by zengenuity
    Issue #3204694 by zengenuity, geek-merlin, jsacksick: Prevent exceptions...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.