Skip to content
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

Can't proceed to checkout if order total is equal to 0 (blocked at details step) #10787

Closed
Cecilia-Hn opened this issue May 2, 2023 · 4 comments
Labels
bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround.

Comments

@Cecilia-Hn
Copy link

Cecilia-Hn commented May 2, 2023

Description

When a shop displays products at zero euros and a customer wants to shop products at zero euros from this shop, the tool loops on step 1 of spit checkout.

Expected Behavior

Client should be able to shop products at zero euros

Actual Behaviour

Shop displays products at zero euros
Customer add products at zero euros to his cart
Customer selects "Checkout"
Customer is stuck on the 1st step "1-Your details"

How to test

  1. As a shop manager, create a shop that sells a 0 product
  2. As a customer, add this product to cart
  3. Proceed to checkout
  4. On details step, fill the form
  5. Submit
  6. See that you're redirected to the details page.

I've create a shop, can be easily reproduced: https://staging.coopcircuits.fr/free-products-shop/shop

Workaround

No free products on a shop

Severity

S3
It's a real bug, but it concerns a rare use of the platform, so I would say S3

@jibees jibees added the bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround. label May 2, 2023
@jibees
Copy link
Contributor

jibees commented May 2, 2023

Notes for developper: It's probably related to the order state, that is not able to be set to payment if there is only product at 0 and one is then redirected to details step when trying to proceed to payment step.

go_to_state :payment, if: ->(order) {
order.update_totals
order.payment_required?
}

def payment_required?
total.to_f > 0.0 && !skip_payment_for_subscription?
end

@jibees jibees changed the title Split checkout dont allow the purchase of free product Can't proceed to checkout of order total is equal to 0 (blocked at details step) May 2, 2023
@jibees
Copy link
Contributor

jibees commented May 2, 2023

Note that this could probably happen if product is not equal to 0 but if you have paid products + vouchers (or negative fees) so that it brings the order total to 0.

@jibees jibees changed the title Can't proceed to checkout of order total is equal to 0 (blocked at details step) Can't proceed to checkout if order total is equal to 0 (blocked at details step) May 2, 2023
@jibees
Copy link
Contributor

jibees commented May 2, 2023

Possible fix:

diff --git a/app/models/spree/order.rb b/app/models/spree/order.rb
index 40dfbcb093..b3cee9f775 100644
--- a/app/models/spree/order.rb
+++ b/app/models/spree/order.rb
@@ -205,7 +205,7 @@ module Spree
     #   Subscriptions place orders at the beginning of an order cycle. They need to
     #   be completed to draw from stock levels and trigger emails.
     def payment_required?
-      total.to_f > 0.0 && !skip_payment_for_subscription?
+      !skip_payment_for_subscription?
     end
 
     # Returns the relevant zone (if any) to be used for taxation purposes.

Will submit a draft PR, and see how specs goes...

@filipefurtad0
Copy link
Contributor

#11135 fixes this 🎉 closing!

Please note that orders with total = 0 will appear on the payments report like so:

image

I think the none string is not translated, but I'm not even sure we should have this line on the report. Happy for feedback on this - discussion here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround.
Projects
None yet
3 participants