diff --git a/web/cobrands/bexley/waste.js b/web/cobrands/bexley/waste.js index c21ac3a963..94a1e9bf0a 100644 --- a/web/cobrands/bexley/waste.js +++ b/web/cobrands/bexley/waste.js @@ -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); });