Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

As of

Jira
serverTornevall Networks
serverIdef1f2374-e58a-319f-9d38-10348dbac859
keyRWC-251
, a feature that (barely) handles zero amount orders are added to support Resurs Checkout, as Resurs Checkout is normally not supporting 0 amounts. One thing for example, if an order is 0, there may be payment methods that will show up on this amount, but the iframe may not properly work. So this is how we handle such cases, even if the frontend handlers may be quite buggy - and we actually only playing with form fields that is quite conditional. This also means that if you have a theme that not following any proper standard, the below solution is guaranteed to fail.

Code View the code change here..

Procedure

  1. Front end hooks into the js trigger updated_checkout.
  2. When updated_checkout is triggered the plugin has pushed a variable through the filter woocommerce_update_order_review_fragments.
  3. We should probably add an element rbwc_cart_total somewhere on the page, since we wrongfully using this fake element to store the cart total temporarily.
  4. rbwc_cart_total is keeping track on when cart total becomes 0, and proceeding through resursPlaceOrderControl() in the front end.
  5. WooCommerce is updating the "place order"-button automatically when the cart is processing the fragments, so if the cart total is 0, that button returns to the store again, together with the iframe.
  6. In resursPlaceOrderControl, when the order total is validated as 0, the customer billing/shipping fields will show up again, and the iframe will be temporarily be hidden.
  7. If the order total is revalidated again as above 0, the billing/shipping fields will hide again, and the iframe will be restored.

...