From f5b1d44e8cd97e05505b9a4d60306a31604568ac Mon Sep 17 00:00:00 2001 From: Moon Date: Fri, 9 Apr 2021 12:44:25 -0700 Subject: [PATCH] Add settings_section event prop for CES (https://github.com/woocommerce/woocommerce-admin/pull/6762) * Add settings_section event prop for CES * Add changelog --- plugins/woocommerce-admin/readme.txt | 1 + .../src/Features/CustomerEffortScoreTracks.php | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/woocommerce-admin/readme.txt b/plugins/woocommerce-admin/readme.txt index fada464f0e2..2fbfe9cfdc6 100644 --- a/plugins/woocommerce-admin/readme.txt +++ b/plugins/woocommerce-admin/readme.txt @@ -75,6 +75,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt == Unreleased == +- Tweak: Add settings_section event prop for CES #6762 - Fix: Retain persisted queries when navigating to Homescreen #6614 - Update: Update choose niche note cta URL #6733 - Fix: Update folded header style #6724 diff --git a/plugins/woocommerce-admin/src/Features/CustomerEffortScoreTracks.php b/plugins/woocommerce-admin/src/Features/CustomerEffortScoreTracks.php index 5f35310c2ec..b4f726f9b3e 100644 --- a/plugins/woocommerce-admin/src/Features/CustomerEffortScoreTracks.php +++ b/plugins/woocommerce-admin/src/Features/CustomerEffortScoreTracks.php @@ -358,11 +358,20 @@ class CustomerEffortScoreTracks { public function run_on_update_options() { // $current_tab is set when WC_Admin_Settings::save_settings is called. global $current_tab; + global $current_section; if ( $this->has_been_shown( self::SETTINGS_CHANGE_ACTION_NAME ) ) { return; } + $props = array( + 'settings_area' => $current_tab, + ); + + if ( $current_section ) { + $props['settings_section'] = $current_section; + } + $this->enqueue_to_ces_tracks( array( 'action' => self::SETTINGS_CHANGE_ACTION_NAME, @@ -373,9 +382,7 @@ class CustomerEffortScoreTracks { 'onsubmit_label' => $this->onsubmit_label, 'pagenow' => 'woocommerce_page_wc-settings', 'adminpage' => 'woocommerce_page_wc-settings', - 'props' => (object) array( - 'settings_area' => $current_tab, - ), + 'props' => (object) $props, ) ); }