Skip to content

Commit

Permalink
fix: use query param instead of only referrer
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoo committed Sep 5, 2024
1 parent 788faa4 commit 5bbe764
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions includes/class-modal-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,7 @@ public static function woocommerce_payment_successful_result( $result ) {
$order_id = $result['order_id'];
$order = \wc_get_order( $order_id );
$modal_checkout_url = $order->get_meta( '_newspack_modal_checkout_url' );
if (
empty( $modal_checkout_url ) ||
(
// Until we use the modal checkout flow from My Account, we don't want to show the modal checkout thank you template for checkouts originating from My Account.
method_exists( 'Newspack\WooCommerce_My_Account', 'is_from_my_account' ) && \Newspack\WooCommerce_My_Account::is_from_my_account()
)
) {
if ( empty( $modal_checkout_url ) ) {
return $result;
}

Expand Down Expand Up @@ -1080,6 +1074,10 @@ public static function hide_expiry_message_shop_link( $message ) {
* Is this request using the modal checkout?
*/
public static function is_modal_checkout() {
// Until we use the modal checkout flow from My Account, we don't want to show the modal checkout thank you template for checkouts originating from My Account.
if ( method_exists( 'Newspack\WooCommerce_My_Account', 'is_from_my_account' ) && \Newspack\WooCommerce_My_Account::is_from_my_account() ) {
return false;
}

$is_modal_checkout = isset( $_REQUEST['modal_checkout'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( ! $is_modal_checkout && isset( $_REQUEST['post_data'] ) && is_string( $_REQUEST['post_data'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
Expand Down

0 comments on commit 5bbe764

Please sign in to comment.