Hide main payment settings save changes button (#50064)

* Hide save changes button for main payment settings screen

* Changelog

* Moved logic
This commit is contained in:
Ilyas Foo 2024-07-29 13:30:01 +08:00 committed by GitHub
parent 928271b427
commit 11c8567c4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Hide save changes button in main payments screen

View File

@ -55,13 +55,12 @@ class WC_Settings_Payment_Gateways_React extends WC_Settings_Page {
*/ */
public function output() { public function output() {
//phpcs:disable WordPress.Security.NonceVerification.Recommended //phpcs:disable WordPress.Security.NonceVerification.Recommended
global $current_section, $hide_save_button; global $current_section;
// Load gateways so we can show any global options they may have. // Load gateways so we can show any global options they may have.
$payment_gateways = WC()->payment_gateways->payment_gateways(); $payment_gateways = WC()->payment_gateways->payment_gateways();
if ( $this->should_render_react_section( $current_section ) ) { if ( $this->should_render_react_section( $current_section ) ) {
$hide_save_button = true;
$this->render_react_section( $current_section ); $this->render_react_section( $current_section );
} elseif ( $current_section ) { } elseif ( $current_section ) {
$this->render_classic_gateway_settings_page( $payment_gateways, $current_section ); $this->render_classic_gateway_settings_page( $payment_gateways, $current_section );
@ -89,6 +88,8 @@ class WC_Settings_Payment_Gateways_React extends WC_Settings_Page {
* @param string $section The section to render. * @param string $section The section to render.
*/ */
private function render_react_section( $section ) { private function render_react_section( $section ) {
global $hide_save_button;
$hide_save_button = true;
echo '<div id="experimental_wc_settings_payments_' . esc_attr( $section ) . '"></div>'; echo '<div id="experimental_wc_settings_payments_' . esc_attr( $section ) . '"></div>';
} }