WC_Admin_Post_Types::maybe_display_warning_for_password_protected_coupon
Shows a warning when editing a password-protected coupon.
Method of the class: WC_Admin_Post_Types{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->maybe_display_warning_for_password_protected_coupon();
Changelog
| Since 9.2.0 | Introduced. |
WC_Admin_Post_Types::maybe_display_warning_for_password_protected_coupon() WC Admin Post Types::maybe display warning for password protected coupon code WC 10.6.2
private function maybe_display_warning_for_password_protected_coupon() {
if ( ! function_exists( 'get_current_screen' ) || 'shop_coupon' !== get_current_screen()->id ) {
return;
}
if ( ! isset( $GLOBALS['post'] ) || 'shop_coupon' !== $GLOBALS['post']->post_type ) {
return;
}
wp_admin_notice(
__(
'This coupon is password protected. WooCommerce does not support password protection for coupons. You can temporarily hide a coupon by making it private. Alternatively, usage limits and restrictions can be configured below.',
'woocommerce'
),
array(
'type' => 'warning',
'id' => 'wc-password-protected-coupon-warning',
'additional_classes' => empty( $GLOBALS['post']->post_password ) ? array( 'hidden' ) : array(),
)
);
}