Skip to content

Commit

Permalink
fix(delivery-options): fix not showing after switching shipping method (
Browse files Browse the repository at this point in the history
#113)

Resolves #105
  • Loading branch information
EdieLemoine authored Jan 19, 2022
1 parent 288c5d5 commit 45590a9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions views/js/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@
}

/**
* @returns {jQuery|null}
* @returns {boolean}
*/
function getRenderedDeliveryOptions() {
return getElement('form.myparcel-delivery-options');
function hasUnRenderedDeliveryOptions() {
return Boolean(getElement('#myparcel-delivery-options'));
}

/**
Expand Down Expand Up @@ -152,10 +152,10 @@
*
*/
function updateDeliveryOptions() {
if (getRenderedDeliveryOptions()) {
document.dispatchEvent(new Event('myparcel_update_config'));
} else {
if (hasUnRenderedDeliveryOptions()) {
document.dispatchEvent(new Event('myparcel_render_delivery_options'));
} else {
document.dispatchEvent(new Event('myparcel_update_config'));
}
}

Expand Down

0 comments on commit 45590a9

Please sign in to comment.