isPro ) { return; } add_action( 'bbmmp_settings_after_form', array( $this, 'renderPanel' ) ); add_action( 'admin_notices', array( $this, 'maybeRenderNotice' ) ); add_action( 'admin_post_' . self::DISMISS, array( $this, 'dismiss' ) ); } public function renderPanel(): void { $features = array( array( __( 'Canada Post labels', 'maple-parcel' ), __( 'Make a label for a parcel within Canada from the order screen, and the tracking number goes to your customer.', 'maple-parcel' ), ), array( __( 'Pack into your own boxes', 'maple-parcel' ), __( 'List the boxes you ship in once. Each order is quoted as the fewest boxes that hold it, at each box\'s real size and weight.', 'maple-parcel' ), ), array( __( 'Price adjustments per zone', 'maple-parcel' ), __( 'Add a handling fee or a percentage to Canada Post\'s price, or take money off, zone by zone.', 'maple-parcel' ), ), array( __( 'Shipping-class rules', 'maple-parcel' ), __( 'For each shipping class, hide Canada Post or some of its services, add a fee, or ship free when the whole cart is in free classes.', 'maple-parcel' ), ), ); ?>

onShippingSettings() ) { return; } if ( '' !== (string) get_user_meta( get_current_user_id(), self::DISMISSED, true ) ) { return; } if ( ! self::hasRatedLongEnough() ) { return; } $this->renderNotice(); } public function dismiss(): void { if ( ! current_user_can( self::CAP ) ) { wp_die( esc_html__( 'You are not allowed to do that.', 'maple-parcel' ), 403 ); } check_admin_referer( self::DISMISS ); update_user_meta( get_current_user_id(), self::DISMISSED, BBMMP_VERSION ); $back = wp_get_referer(); wp_safe_redirect( is_string( $back ) && '' !== $back ? $back : admin_url( 'admin.php?page=wc-settings&tab=shipping' ) ); exit; } /** Whether checkout first got a live Canada Post rate at least two weeks ago. */ public static function hasRatedLongEnough(): bool { $first = Health::firstRateAt(); return $first > 0 && time() - $first >= self::WAIT; } public function renderNotice(): void { $dismiss = wp_nonce_url( admin_url( 'admin-post.php?action=' . self::DISMISS ), self::DISMISS ); ?>

 ·   ·