eventespresso / ee-code-snippet-library

EE Code Snippet Library
GNU General Public License v2.0
29 stars 19 forks source link

ee-code-snippet-library/checkout/bc_add_cart_modifier.php #7

Closed boethius closed 6 years ago

boethius commented 7 years ago

Line Items are not updated upon payment method change.

Affected snippet: ee-code-snippet-library/checkout/bc_add_cart_modifier.php

Expected

  1. Select tickets
    1. Sum without fees are displayed.
  2. Enter details correctly
    1. Payment options are displayed.
  3. Select invoice
    1. Total is adapted to reflect the newly applied extra fee
    2. The additional fee is added as a line item to the cart
  4. User continues to finalize
    1. Page with invoice details and the correct new total is displayed.
    2. Invoice and Receipt reflect added LineItem.
  5. User changes payment method
    1. The correct total is shown on the line items.

Actual

3.i. and 3.ii. do not occur. The user does not see any changes to the total until 4. Isn't there supposed to be some kind of update to cart triggered once the payment methods are triggered over the XHR requests?

Environment

nerrad commented 7 years ago

link to snippet in question: https://github.com/eventespresso/ee-code-snippet-library/blob/master/checkout/bc_add_cart_modifier.php

tn3rb commented 7 years ago

Isn't there supposed to be some kind of update to cart triggered once the payment methods are triggered over the XHR requests?

No sorry, that snippet hooks into the payment options form processing request to add the line items, not when you are switching payment options, so it does not update the payment options screen immediately.

Why? Because that is beyond the scope of that snippet, since updating the DOM via AJAX can be quite complex. It would also require repeated updates whenever someone switched away from invoice to something else, so the line items are only generated when the form is submitted, which is why they appear correctly in steps 4 and 5 as you have noted.

If you are concerned about customers being aware of this extra charge, you should add some text to your invoice settings description in the payment methods admin. That text appears on the frontend when they select invoice.

Hope that helps