@@ -421,6 +421,10 @@ function getUpdatedTransaction({
421421 shouldStopSmartscan = true ;
422422 }
423423
424+ if ( Object . hasOwn ( transactionChanges , 'wasMerchantCleared' ) ) {
425+ updatedTransaction . wasMerchantCleared = transactionChanges . wasMerchantCleared ;
426+ }
427+
424428 if ( Object . hasOwn ( transactionChanges , 'waypoints' ) ) {
425429 updatedTransaction . modifiedWaypoints = transactionChanges . waypoints ;
426430 updatedTransaction . isLoading = true ;
@@ -680,8 +684,12 @@ function isUnreportedAndHasInvalidDistanceRateTransaction(transaction: OnyxInput
680684 * Return the merchant field from the transaction, return the modifiedMerchant if present.
681685 */
682686function getMerchant ( transaction : OnyxInputOrEntry < Transaction > , policyParam : OnyxEntry < Policy > = undefined ) : string {
683- if ( transaction && isDistanceRequest ( transaction ) ) {
684- const report = getReportOrDraftReport ( transaction . reportID ) ;
687+ if ( ! transaction ) {
688+ return '' ;
689+ }
690+
691+ const report = getReportOrDraftReport ( transaction . reportID ) ;
692+ if ( isDistanceRequest ( transaction ) ) {
685693 // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850
686694 // eslint-disable-next-line deprecation/deprecation
687695 const policy = policyParam ?? getPolicy ( report ?. policyID ) ;
@@ -694,7 +702,12 @@ function getMerchant(transaction: OnyxInputOrEntry<Transaction>, policyParam: On
694702 ) ;
695703 }
696704 }
697- return transaction ?. modifiedMerchant ? transaction . modifiedMerchant : ( transaction ?. merchant ?? '' ) ;
705+
706+ // Check if merchant was intentionally cleared by user (only for personal expenses)
707+ if ( transaction . wasMerchantCleared ) {
708+ return '' ;
709+ }
710+ return transaction . modifiedMerchant ? transaction . modifiedMerchant : ( transaction . merchant ?? '' ) ;
698711}
699712
700713function getMerchantOrDescription ( transaction : OnyxEntry < Transaction > ) {
0 commit comments