Skip to content

Commit

Permalink
fixup! [Bexley][WW] Update displayed GGW bin costs and total depdendi…
Browse files Browse the repository at this point in the history
…ng on if DD or not.

Fix price display on form error.
  • Loading branch information
neprune committed Feb 19, 2025
1 parent 9aedb47 commit 45084ff
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions web/cobrands/bexley/waste.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,15 @@ window.garden_waste_first_bin_discount_applies = function() {
};

$(function() {
// If there's an error when submitting the subscribe form,
// the first bin discount won't be displayed even when it should apply.
// This is due to how the form is set-up on the server.
// We work around this by just checking if the discount should apply
// when the page loads and running the cost calculation function if so.
window.onload = function() {
if (window.garden_waste_first_bin_discount_applies()) {
window.garden_waste_bin_cost_new();
}
};
$('#subscribe_details input[name="payment_method"]').on('change', window.garden_waste_bin_cost_new);
});

0 comments on commit 45084ff

Please sign in to comment.