Automattic\WooCommerce\Internal\Admin\Notes
InstallJPAndWCSPlugins::action_note
Action the Install Jetpack and WooCommerce Shipping & Tax note, if any exists, and as long as both the Jetpack and WooCommerce Shipping & Tax plugins have been activated.
Method of the class: InstallJPAndWCSPlugins{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = InstallJPAndWCSPlugins::action_note();
InstallJPAndWCSPlugins::action_note() InstallJPAndWCSPlugins::action note code WC 10.5.0
public static function action_note() {
// Make sure that both plugins are active before actioning the note.
$active_plugin_slugs = PluginsHelper::get_active_plugin_slugs();
$jp_active = in_array( 'jetpack', $active_plugin_slugs, true );
$wcs_active = in_array( 'woocommerce-services', $active_plugin_slugs, true );
if ( ! $jp_active || ! $wcs_active ) {
return;
}
// Action any notes with a matching name.
$data_store = Notes::load_data_store();
$note_ids = $data_store->get_notes_with_name( self::NOTE_NAME );
foreach ( $note_ids as $note_id ) {
$note = Notes::get_note( $note_id );
if ( $note ) {
$note->set_status( Note::E_WC_ADMIN_NOTE_ACTIONED );
$note->save();
}
}
}