Automattic\WooCommerce\Internal\Admin\Notes
FullRefundFixDataToolNotice{}
FullRefundFixDataToolNotice
Хуков нет.
Использование
$FullRefundFixDataToolNotice = new FullRefundFixDataToolNotice(); // use class methods
Методы
- public static get_note()
- public static is_applicable()
Список изменений
| С версии 11.2.0 | Введена. |
Код FullRefundFixDataToolNotice{} FullRefundFixDataToolNotice{} WC 11.2.2
class FullRefundFixDataToolNotice {
/**
* Note traits.
*/
use NoteTraits;
/**
* Name of the note for use in the database.
*/
const NOTE_NAME = 'wc-admin-full-refund-fix-data-tool';
/**
* Should this note exist?
*
* @return bool
*/
public static function is_applicable() {
if ( ! FeaturesUtil::feature_is_enabled( 'analytics' ) ) {
return false;
}
// The notice follows the underlying data state, not the tool-row
// visibility flag (`woocommerce_analytics_show_old_refund_data_tool`),
// so it auto-hides once the fix has been applied.
return ! OrderUtil::uses_new_full_refund_data();
}
/**
* Get the note.
*
* @return Note|null
*/
public static function get_note() {
if ( ! self::is_applicable() ) {
return null;
}
$note = new Note();
$note->set_title( __( 'Fix your refund data in Analytics', 'woocommerce' ) );
$note->set_content(
__( 'We found some refunded orders where the full refund amount was not recorded correctly in your Analytics reports. Use the full refund fix tool on the Status page to re-import the affected data.', 'woocommerce' )
);
$note->set_content_data( (object) array() );
$note->set_type( Note::E_WC_ADMIN_NOTE_WARNING );
$note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' );
$note->add_action(
'full-refund-fix-data-tool_view',
__( 'Fix refund data', 'woocommerce' ),
admin_url( 'admin.php?page=wc-status&tab=tools' ),
Note::E_WC_ADMIN_NOTE_UNACTIONED,
true
);
return $note;
}
}