init(); } /** * Get the class instance * * @return WC_ALP_Admin_Notices_Under_WC_Admin */ public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } /* * init from parent mail class */ public function init() { add_action( 'alp_settings_admin_notice', array( $this, 'alp_settings_admin_notice' ) ); add_action('admin_notices', array( $this, 'alp_pro194' ) ); add_action( 'admin_init', array( $this, 'alp_notice_dismiss194' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'alp_pro194_notice_styles' ), 20 ); // Second upgrade trigger at a moment of value: once the store has taken // MILESTONE_ORDERS local-pickup orders, on the WooCommerce order screens. add_action( 'woocommerce_order_status_changed', array( $this, 'alp_count_pickup_order' ), 20, 4 ); add_action( 'admin_notices', array( $this, 'alp_pickup_milestone_notice' ) ); add_action( 'admin_init', array( $this, 'alp_handle_milestone_dismiss' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'alp_milestone_notice_styles' ), 20 ); // Black Friday 2026 Advanced Local Pickup Pro sale (ZUI plugin notice, dismissible per user). add_action( 'admin_enqueue_scripts', array( $this, 'alp_bfcm_notice_styles' ), 20 ); add_action( 'admin_notices', array( $this, 'alp_bfcm_notice' ) ); add_action( 'admin_init', array( $this, 'alp_bfcm_notice_ignore' ) ); // Review request notice (ZUI plugin-notice card) // add_action( 'admin_notices', array( $this, 'alp_free_review_notice' ) ); // add_action( 'admin_init', array( $this, 'alp_free_review_notice_ignore' ) ); // add_action( 'admin_enqueue_scripts', array( $this, 'alp_free_review_notice_styles' ) ); } /* * Dismiss the review notice */ public function alp_free_review_notice_ignore() { if ( isset( $_GET['alp-free-review-ignore-notice'] ) && isset( $_GET['nonce'] ) ) { $nonce = sanitize_text_field( wp_unslash( $_GET['nonce'] ) ); if ( wp_verify_nonce( $nonce, 'alp_free_review_notice' ) ) { update_option( 'alp_free_review_notice_ignore', 'true' ); } } } /* * ZUI plugin-notice styles — the review notice renders from `admin_notices` * on every admin page, outside `.zui-scope`, so the standalone component * stylesheet is enqueued here (it has no dependency on the zui.css bundle). */ public function alp_free_review_notice_styles() { if ( get_option( 'alp_free_review_notice_ignore' ) ) { return; } $zui_version_file = wc_local_pickup()->get_plugin_path() . '/assets/zui/VERSION'; $zui_version = is_readable( $zui_version_file ) ? trim( file_get_contents( $zui_version_file ) ) : wc_local_pickup()->version; wp_enqueue_style( 'alp-zui-pnotice', wc_local_pickup()->plugin_dir_url() . 'assets/zui/css/components/plugin-notice.css', array(), $zui_version ); } /* * Display the review request notice (ZUI plugin-notice card) */ public function alp_free_review_notice() { if ( get_option( 'alp_free_review_notice_ignore' ) ) { return; } $nonce = wp_create_nonce( 'alp_free_review_notice' ); $dismissable_url = esc_url( add_query_arg( array( 'alp-free-review-ignore-notice' => 'true', 'nonce' => $nonce ) ) ); ?>
⭐

👍

×
get_plugin_path() . '/assets/zui/VERSION'; $zui_version = is_readable( $zui_version_file ) ? trim( file_get_contents( $zui_version_file ) ) : wc_local_pickup()->version; wp_enqueue_style( 'alp-zui-pnotice', wc_local_pickup()->plugin_dir_url() . 'assets/zui/css/components/plugin-notice.css', array(), $zui_version ); } public function alp_pro194() { // Exclude the notice from the plugin's own settings page. if ( isset( $_GET['page'] ) && 'local_pickup' === $_GET['page'] ) { return; } // The Black Friday notice replaces this nudge while the sale runs. if ( self::alp_is_bfcm_running() ) { return; } if ( get_option( 'alp_notice_dismiss194' ) ) { return; } $nonce = wp_create_nonce( 'alp_notice_close' ); $dismissable_url = esc_url( add_query_arg( array( 'notice-dismiss-alp' => 'true', 'nonce' => $nonce ) ) ); ?>

20% OFF with coupon code ALPPRO20 — limited time only!', 'advanced-local-pickup-for-woocommerce' ) ); ?>

×
get_meta( '_alp_pickup_counted' ) ) { return; } $is_pickup = false; foreach ( $order->get_shipping_methods() as $method ) { if ( false !== strpos( (string) $method->get_method_id(), 'pickup' ) ) { $is_pickup = true; break; } } if ( ! $is_pickup ) { return; } $order->update_meta_data( '_alp_pickup_counted', 1 ); $order->save(); update_option( 'alp_pickup_orders_count', (int) get_option( 'alp_pickup_orders_count', 0 ) + 1, false ); } /** * Milestone card shows only on the order screens, to shop managers, once * the pickup-order count clears the threshold and the snooze has lapsed. */ private function alp_milestone_notice_visible() { $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; return $screen && in_array( $screen->id, self::ORDER_SCREENS, true ) && current_user_can( 'manage_woocommerce' ) && (int) get_option( 'alp_pickup_orders_count', 0 ) >= self::MILESTONE_ORDERS && (int) get_option( 'alp_pickup_milestone_snoozed_until', 0 ) < time(); } /** * Dismissing snoozes for MILESTONE_SNOOZE rather than hiding forever; when * it returns the count in the title has grown, so it isn't a repeat. */ public function alp_handle_milestone_dismiss() { if ( isset( $_GET['alp-milestone-snooze'], $_GET['nonce'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $_GET['nonce'] ) ), 'alp_milestone_snooze' ) ) { update_option( 'alp_pickup_milestone_snoozed_until', time() + self::MILESTONE_SNOOZE, false ); } } /** * Load the .zui-pnotice component only where the milestone card renders * (order screens, outside the settings zui.css bundle). */ public function alp_milestone_notice_styles() { if ( ! $this->alp_milestone_notice_visible() ) { return; } $zui_version_file = wc_local_pickup()->get_plugin_path() . '/assets/zui/VERSION'; $zui_version = is_readable( $zui_version_file ) ? trim( file_get_contents( $zui_version_file ) ) : wc_local_pickup()->version; wp_enqueue_style( 'alp-zui-pnotice', wc_local_pickup()->plugin_dir_url() . 'assets/zui/css/components/plugin-notice.css', array(), $zui_version ); } /** * The second upgrade trigger — shown at a moment of value (orders are * coming through pickup) rather than during setup. Dismissible (snooze). */ public function alp_pickup_milestone_notice() { if ( ! $this->alp_milestone_notice_visible() ) { return; } $count = (int) get_option( 'alp_pickup_orders_count', 0 ); $upgrade_url = alp_pro_upgrade_url( 'pickup-orders-milestone' ); $nonce = wp_create_nonce( 'alp_milestone_snooze' ); $dismiss_url = add_query_arg( array( 'alp-milestone-snooze' => 'true', 'nonce' => $nonce ) ); ?>

×
getTimestamp(); } /** * Whether the Black Friday sale is running right now. * * @return bool */ public static function alp_is_bfcm_running() { $alp_start = ( new DateTimeImmutable( self::BFCM_START, wp_timezone() ) )->getTimestamp(); $alp_now = time(); return $alp_now >= $alp_start && $alp_now <= self::alp_get_bfcm_end_ts(); } /** * Advanced Local Pickup Pro link for a Black Friday placement. * * @param string $placement Placement slug for utm_content. * @return string */ public static function alp_get_bfcm_url( $placement ) { return alp_utm_url( 'https://www.zorem.com/product/zorem-local-pickup-pro/', $placement, 'black-friday-2026' ); } /** * Upgrade button label, e.g. "Upgrade → $77.40". * * @return string */ public static function alp_get_bfcm_button_label() { /* translators: %s: Advanced Local Pickup Pro price after the Black Friday discount, e.g. $77.40. */ $alp_label = __( 'Upgrade → %s', 'advanced-local-pickup-for-woocommerce' ); return sprintf( $alp_label, self::BFCM_SALE_PRICE ); } /** * Black Friday headline. * * @return string */ public static function alp_get_bfcm_title() { /* translators: %s: discount, e.g. 40%. */ $alp_title = __( 'Black Friday: %s off Advanced Local Pickup Pro — only sale of the year', 'advanced-local-pickup-for-woocommerce' ); return sprintf( $alp_title, self::BFCM_DISCOUNT ); } /** * Print the offer detail line: coupon, price, terms and end date. */ public static function render_alp_bfcm_meta() { /* translators: %s: date the Black Friday sale ends. */ $alp_ends = __( 'Ends %s', 'advanced-local-pickup-for-woocommerce' ); $alp_ends = sprintf( $alp_ends, date_i18n( get_option( 'date_format' ), self::alp_get_bfcm_end_ts() ) ); ?> → should_show_alp_bfcm_notice() ) { return; } $zui_version_file = wc_local_pickup()->get_plugin_path() . '/assets/zui/VERSION'; $zui_version = is_readable( $zui_version_file ) ? trim( file_get_contents( $zui_version_file ) ) : wc_local_pickup()->version; wp_enqueue_style( 'alp-zui-pnotice', wc_local_pickup()->plugin_dir_url() . 'assets/zui/css/components/plugin-notice.css', array(), $zui_version ); wp_add_inline_style( 'alp-zui-pnotice', // Full width: clear the floated Screen Options / Help tabs and keep core's 20px right gutter. '.zui-pnotice.alp-bfcm-notice{clear:both;width:auto;margin-inline-end:20px;--zui-pnotice-accent:#0f172a;--zui-pnotice-avatar-bg:#0f172a;--zui-pnotice-avatar-color:#fbbf24}' . '@media (max-width:782px){.zui-pnotice.alp-bfcm-notice{margin-inline-end:10px}}' . '.alp-bfcm-notice .zui-pnotice__close{text-decoration:none}' . '.alp-bfcm-meta{display:flex;flex-wrap:wrap;align-items:center;column-gap:6px;row-gap:4px;font-size:13px;line-height:1.6;color:var(--zui-text-muted,#64748b)}' . '.alp-bfcm-meta__item{display:inline-flex;align-items:center;gap:5px}' . '.alp-bfcm-meta__item+.alp-bfcm-meta__item:before{content:"\00b7";margin-inline-end:6px;color:var(--zui-text-muted,#94a3b8)}' . '.alp-bfcm-meta__code{display:inline-block;margin:0;padding:1px 8px;background:#f8fafc;border:1px dashed #cbd5e1;border-radius:4px;color:#0f172a;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;font-weight:700;letter-spacing:.06em;user-select:all}' . '.alp-bfcm-meta__was{color:#94a3b8}' . '.alp-bfcm-meta__now{color:#0f172a;font-weight:700}' ); } /** * Black Friday notice - 40% off Advanced Local Pickup Pro with coupon BFCM40. */ public function alp_bfcm_notice() { if ( ! $this->should_show_alp_bfcm_notice() ) { return; } $dismiss_url = wp_nonce_url( add_query_arg( 'alp-bfcm-notice-dismiss', '1' ), 'alp_bfcm_notice_dismiss', 'alp_bfcm_nonce' ); ?>

×