Skip to content

Commit

Permalink
Do the classic checkout OSA bindings only on the classic page
Browse files Browse the repository at this point in the history
Call `previousInitCheckout` only if there is one.
  • Loading branch information
tomalec authored and layoutd committed Nov 27, 2023
1 parent cb4dd6e commit 6704a64
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@
};

/**
* Add source values to checkout.
* Add source values to the classic checkout.
*/
const previousInitCheckout = document.body.oninit_checkout;
document.body.oninit_checkout = () => {
setFields();
previousInitCheckout();
};
if ( $( '.woocommerce form.checkout' ) !== null ) {
const previousInitCheckout = document.body.oninit_checkout;
document.body.oninit_checkout = () => {
setFields();
previousInitCheckout && previousInitCheckout();
};
}

/**
* Add source values to register.
Expand Down

0 comments on commit 6704a64

Please sign in to comment.