Skip to content

Commit

Permalink
fix: prevent creation of multiple orders (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
plarsson authored Jun 11, 2023
1 parent fd01f3b commit dd83f72
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions assets/js/ledyer-checkout-for-woocommerce.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ jQuery(function ($) {
}
});

sessionStorage.removeItem('ledyerWooRedirectUrl');

$.ajax({
type: 'POST',
url: lco_params.submit_order,
Expand All @@ -382,7 +384,7 @@ jQuery(function ($) {
// { result: "success" | "failure"; refresh: "boolean", reload: boolean, messages: string; }
try {
if ('success' === data.result) {
lco_wc.logToFile('Successfully validated order in WooCommerce.');
lco_wc.logToFile('Successfully created order in WooCommerce.');
const url = new URL(data.redirect);
sessionStorage.setItem('ledyerWooRedirectUrl', url);

Expand Down Expand Up @@ -449,8 +451,6 @@ jQuery(function ($) {
// This means that placeLedyerOrder was called successfully already
// (Due to an earlier call caused by client validation)
window.location.href = redirectUrl;
} else {
lco_wc.placeLedyerOrder();
}
}
});
Expand Down

0 comments on commit dd83f72

Please sign in to comment.