Automattic\WooCommerce\Internal\Admin\Notes
WooSubscriptionsNotes::update_option_woocommerce_helper_data()
Reacts to changes in the helper option.
Method of the class: WooSubscriptionsNotes{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WooSubscriptionsNotes = new WooSubscriptionsNotes(); $WooSubscriptionsNotes->update_option_woocommerce_helper_data( $old_value, $value );
- $old_value(array) (required)
- The previous value of the option.
- $value(array) (required)
- The new value of the option.
WooSubscriptionsNotes::update_option_woocommerce_helper_data() WooSubscriptionsNotes::update option woocommerce helper data code WC 9.7.1
public function update_option_woocommerce_helper_data( $old_value, $value ) { if ( ! is_array( $old_value ) ) { $old_value = array(); } if ( ! is_array( $value ) ) { $value = array(); } $old_auth = array_key_exists( 'auth', $old_value ) ? $old_value['auth'] : array(); $new_auth = array_key_exists( 'auth', $value ) ? $value['auth'] : array(); $old_token = array_key_exists( 'access_token', $old_auth ) ? $old_auth['access_token'] : ''; $new_token = array_key_exists( 'access_token', $new_auth ) ? $new_auth['access_token'] : ''; // The site just disconnected. if ( ! empty( $old_token ) && empty( $new_token ) ) { $this->remove_notes(); return; } // The site is connected. if ( $this->is_connected() ) { $this->remove_notes(); $this->refresh_subscription_notes(); return; } }