Skip to content

Commit

Permalink
Fixed redirect for free orders
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeholder committed Nov 13, 2024
1 parent b83aec5 commit 563fb0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Stripe for Craft Commerce

## Unreleased

- Fixed a bug where free orders that completed immediately were not redirecting to the order success page. ([#313](https://github.com/craftcms/commerce-stripe/issues/313))

## 4.1.5 - 2024-08-07

- Fixed a bug the billing issues payment form did not display correctly for subscriptions.
Expand Down
5 changes: 5 additions & 0 deletions src/web/assets/elementsform/js/paymentForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ class PaymentIntentsElements {
return;
}

if(json.redirect && json.cart.isCompleted === true) {
window.location.href = json.redirect;
return;
}

const completePaymentActionUrl = new URL(this.completePaymentActionUrl);
completePaymentActionUrl.searchParams.append(
'commerceTransactionHash',
Expand Down

0 comments on commit 563fb0f

Please sign in to comment.