Skip to content

Commit

Permalink
Fix - HPOS compatibility on Edit Order Screen (#7527)
Browse files Browse the repository at this point in the history
Co-authored-by: Jessy P <jessy.pappachan@automattic.com>
  • Loading branch information
jessy-p and Jessy P authored Oct 24, 2023
1 parent 0e2fe50 commit 3c4b117
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions changelog/7466-fix-hpos-compat-order-edit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix order status inconsistency in HPOS mode on Order Edit screen.
10 changes: 9 additions & 1 deletion client/order/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@ jQuery( function ( $ ) {
);

$( 'select#order_status' ).on( 'change', function () {
const originalStatus = $( 'input#original_post_status' ).val();
//get the original status of the order from post or order data.
let originalStatus =
$( 'input#original_post_status' ).val() ||
$( 'input#original_order_status' ).val();
//TODO: Remove this after https://github.com/woocommerce/woocommerce/issues/40871 is fixed.
if ( originalStatus && ! originalStatus.startsWith( 'wc-' ) ) {
originalStatus = 'wc-' + originalStatus;
}

const canRefund = getConfig( 'canRefund' );
const refundAmount = getConfig( 'refundAmount' );
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ describe( 'Order > Status Change', () => {
await merchant.logout();
} );

// TODO: unskip when https://github.com/Automattic/woocommerce-payments/issues/7466 is closed
it.skip( 'Show Cancel Confirmation modal, do not change status if Do Nothing selected', async () => {
it( 'Show Cancel Confirmation modal, do not change status if Do Nothing selected', async () => {
// Select cancel from the order status dropdown.
await expect( page ).toSelect(
orderStatusDropdownSelector,
Expand Down Expand Up @@ -148,8 +147,7 @@ describe( 'Order > Status Change', () => {
await merchant.logout();
} );

// TODO: unskip when https://github.com/Automattic/woocommerce-payments/issues/7466 is closed
it.skip( 'Show Refund Confirmation modal, do not change status if Cancel clicked', async () => {
it( 'Show Refund Confirmation modal, do not change status if Cancel clicked', async () => {
// Select refunded from the order status dropdown.
await expect( page ).toSelect(
orderStatusDropdownSelector,
Expand Down

0 comments on commit 3c4b117

Please sign in to comment.