Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing transaction error when viewing orders placed in mismatched test mode #7972

Merged
merged 6 commits into from
Jan 5, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions client/order/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jQuery( function ( $ ) {
const disableManualRefunds = getConfig( 'disableManualRefunds' ) ?? false;
const manualRefundsTip = getConfig( 'manualRefundsTip' ) ?? '';
const chargeId = getConfig( 'chargeId' );
const testMode = getConfig( 'testMode' );
const orderTestMode = getConfig( 'testMode' );

maybeShowOrderNotices();

Expand Down Expand Up @@ -175,16 +175,20 @@ jQuery( function ( $ ) {
'#wcpay-order-payment-details-container'
);

// If the container doesn't exist (WC < 7.9), or the charge ID isn't present, don't render the notice.
// Check if the order's test mode meta matches the site's current test mode setting.
// E.g. order and site are both in test mode, or both in live mode.
const isOrderTestModeMatch = orderTestMode === wcpaySettings.testMode;

// If the container doesn't exist (WC < 7.9) don't render the notice.
if ( ! container ) {
return;
}

ReactDOM.render(
<>
{ testMode && <TestModeNotice /> }
{ orderTestMode && <TestModeNotice /> }

{ chargeId && (
{ isOrderTestModeMatch && chargeId && (
<DisputedOrderNoticeHandler
chargeId={ chargeId }
onDisableOrderRefund={ disableWooOrderRefundButton }
Expand Down
Loading