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 double indicators showing under Payments tab #7201

Merged
merged 2 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions changelog/fix-7042-double-payments-badge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix double indicators showing under Payments tab
7 changes: 5 additions & 2 deletions includes/admin/class-wc-payments-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -954,9 +954,12 @@ public function add_menu_notification_badge() {
return;
}

$badge = self::MENU_NOTIFICATION_BADGE;
foreach ( $menu as $index => $menu_item ) {
if ( 'wc-admin&path=/payments/connect' === $menu_item[2] ) {
$menu[ $index ][0] .= self::MENU_NOTIFICATION_BADGE; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
if ( false === strpos( $menu_item[0], $badge ) && ( 'wc-admin&path=/payments/connect' === $menu_item[2] ) ) {
$menu[ $index ][0] .= $badge; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited

// One menu item with a badge is more than enough.
break;
}
}
Expand Down
7 changes: 5 additions & 2 deletions includes/class-wc-payments-incentives-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ public function add_payments_menu_badge(): void {
return;
}

$badge = WC_Payments_Admin::MENU_NOTIFICATION_BADGE;
foreach ( $menu as $index => $menu_item ) {
if ( 'wc-admin&path=/payments/connect' === $menu_item[2] ) {
$menu[ $index ][0] .= WC_Payments_Admin::MENU_NOTIFICATION_BADGE; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
if ( false === strpos( $menu_item[0], $badge ) && ( 'wc-admin&path=/payments/connect' === $menu_item[2] ) ) {
$menu[ $index ][0] .= $badge; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited

// One menu item with a badge is more than enough.
break;
}
}
Expand Down
Loading