admin->get_data_byid( $location_id ); // New location flow (id=0): build an empty stdClass so isset() checks below don't blow up. if ( ! is_object( $location ) ) { $location = new stdClass(); } $cancel_url = admin_url( 'admin.php?page=local_pickup&tab=locations' ); $store_name = isset( $location->store_name ) ? stripslashes( $location->store_name ) : ''; // Address subtitle. $address_subtitle = ''; $country_setting = isset( $location->store_country ) ? $location->store_country : get_option( 'woocommerce_default_country' ); if ( strstr( $country_setting, ':' ) ) { $country_setting = explode( ':', $country_setting ); $country = current( $country_setting ); $state = end( $country_setting ); } else { $country = $country_setting; $state = ''; } if ( ! empty( $location->store_address ) ) { $address_subtitle .= esc_html( $location->store_address ); } if ( ! empty( $location->store_address_2 ) ) { $address_subtitle .= ', ' . esc_html( $location->store_address_2 ); } if ( ! empty( $location->store_city ) ) { $address_subtitle .= ', ' . esc_html( $location->store_city ); } if ( ! empty( $location->store_postcode ) ) { $address_subtitle .= ' - ' . esc_html( $location->store_postcode ); } if ( $country && ! empty( $location->store_name ) && isset( WC()->countries->countries[ $country ] ) ) { $address_subtitle .= ', ' . esc_html( WC()->countries->countries[ $country ] ) . '.'; } // PRO-locked sections to render below the editable ones. // This is the strongest settings-page upgrade surface (AST's top converter is // the equivalent), so it uses the canonical utm_content=plugin-setting. $alp_upgrade_url = alp_pro_upgrade_url( 'plugin-setting' ); $alp_pro_sections = array( array( 'title' => esc_html__( 'Pickup Appointments', 'advanced-local-pickup-for-woocommerce' ), 'sub' => esc_html__( 'Configure reservable customer booking time slots.', 'advanced-local-pickup-for-woocommerce' ), 'desc' => esc_html__( 'Let customers book a specific pickup time slot when placing the order. Configure days, intervals, and capacity per slot.', 'advanced-local-pickup-for-woocommerce' ), ), array( 'title' => esc_html__( 'Products', 'advanced-local-pickup-for-woocommerce' ), 'sub' => esc_html__( 'Restrict this pickup location to specific products or categories.', 'advanced-local-pickup-for-woocommerce' ), 'desc' => esc_html__( 'Make this location available only for selected products, categories, or exclude specific items entirely.', 'advanced-local-pickup-for-woocommerce' ), ), array( 'title' => esc_html__( 'Shipping Method', 'advanced-local-pickup-for-woocommerce' ), 'sub' => esc_html__( 'Excluded shipping methods for this location.', 'advanced-local-pickup-for-woocommerce' ), 'desc' => esc_html__( 'Configure which WooCommerce shipping methods should be hidden when this pickup location is selected.', 'advanced-local-pickup-for-woocommerce' ), ), array( 'title' => esc_html__( 'Payment Method', 'advanced-local-pickup-for-woocommerce' ), 'sub' => esc_html__( 'Excluded payment gateways at checkout.', 'advanced-local-pickup-for-woocommerce' ), 'desc' => esc_html__( 'Restrict which payment gateways are available when customers choose this pickup location.', 'advanced-local-pickup-for-woocommerce' ), ), array( 'title' => esc_html__( 'Price Adjustments', 'advanced-local-pickup-for-woocommerce' ), 'sub' => esc_html__( 'No markup or discounts on free tier.', 'advanced-local-pickup-for-woocommerce' ), 'desc' => esc_html__( 'Apply a percentage or flat discount, or a pickup fee, when this location is chosen.', 'advanced-local-pickup-for-woocommerce' ), ), array( 'title' => esc_html__( 'Notifications', 'advanced-local-pickup-for-woocommerce' ), 'sub' => esc_html__( 'Notify additional recipients about this location.', 'advanced-local-pickup-for-woocommerce' ), 'desc' => esc_html__( 'Send pickup notifications to additional store staff or location managers in addition to the customer.', 'advanced-local-pickup-for-woocommerce' ), ), array( 'title' => esc_html__( 'Automations', 'advanced-local-pickup-for-woocommerce' ), 'sub' => esc_html__( 'Status-change reminders and follow-ups.', 'advanced-local-pickup-for-woocommerce' ), 'desc' => esc_html__( 'Schedule automatic reminders before pickup, mark orders Picked Up after X days, and similar workflows.', 'advanced-local-pickup-for-woocommerce' ), ), array( 'title' => esc_html__( 'Curbside Pickup', 'advanced-local-pickup-for-woocommerce' ), 'sub' => esc_html__( 'Status: Disabled', 'advanced-local-pickup-for-woocommerce' ), 'desc' => esc_html__( 'Let customers notify the store when they have arrived for curbside delivery. Configure prompts, vehicle details, and arrival flow.', 'advanced-local-pickup-for-woocommerce' ), ), ); ?>

0 ) ? esc_html__( 'Edit Pickup Location', 'advanced-local-pickup-for-woocommerce' ) : esc_html__( 'Add Pickup Location', 'advanced-local-pickup-for-woocommerce' ); ?>

store_country ) ? $location->store_country : get_option( 'woocommerce_default_country' ); if ( strstr( $country_value, ':' ) ) { $country_value = explode( ':', $country_value ); $country_sel = current( $country_value ); $state_sel = end( $country_value ); } else { $country_sel = $country_value; $state_sel = '*'; } ?>
store_days ) ? $location->store_days : ''; $store_days_val = $store_days_serialized ? @unserialize( $store_days_serialized ) : get_option( 'wclp_store_days' ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged,WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize if ( ! empty( $store_days_val ) && ! empty( $location->store_name ) ) { $all_days_subtitle = array( 'sunday' => esc_html__( 'Sunday', 'advanced-local-pickup-for-woocommerce' ), 'monday' => esc_html__( 'Monday', 'advanced-local-pickup-for-woocommerce' ), 'tuesday' => esc_html__( 'Tuesday', 'advanced-local-pickup-for-woocommerce' ), 'wednesday' => esc_html__( 'Wednesday', 'advanced-local-pickup-for-woocommerce' ), 'thursday' => esc_html__( 'Thursday', 'advanced-local-pickup-for-woocommerce' ), 'friday' => esc_html__( 'Friday', 'advanced-local-pickup-for-woocommerce' ), 'saturday' => esc_html__( 'Saturday', 'advanced-local-pickup-for-woocommerce' ), ); $w_day_subtitle = array_slice( $all_days_subtitle, (int) get_option( 'start_of_week' ) ); foreach ( $all_days_subtitle as $k => $v ) { $w_day_subtitle[ $k ] = $v; } foreach ( $store_days_val as $k => $v ) { if ( isset( $w_day_subtitle[ $k ] ) ) { $w_day_subtitle[ $k ] = $v; } } foreach ( $w_day_subtitle as $key => $val ) { if ( is_array( $val ) && isset( $val['checked'] ) && 1 === intval( $val['checked'] ) && ! empty( $val['wclp_store_hour'] ) && ! empty( $val['wclp_store_hour_end'] ) ) { $hours_subtitle .= substr( ucfirst( $key ), 0, 3 ) . ': ' . esc_html( $val['wclp_store_hour'] ) . '-' . esc_html( $val['wclp_store_hour_end'] ) . ' '; } } } ?>
store_time_format ) ? $location->store_time_format : '24'; $store_days_data = isset( $location->store_days ) ? @unserialize( $location->store_days ) : get_option( 'wclp_store_days' ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged,WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize $all_days_bh = array( 'sunday' => esc_html__( 'Sunday', 'advanced-local-pickup-for-woocommerce' ), 'monday' => esc_html__( 'Monday', 'advanced-local-pickup-for-woocommerce' ), 'tuesday' => esc_html__( 'Tuesday', 'advanced-local-pickup-for-woocommerce' ), 'wednesday' => esc_html__( 'Wednesday', 'advanced-local-pickup-for-woocommerce' ), 'thursday' => esc_html__( 'Thursday', 'advanced-local-pickup-for-woocommerce' ), 'friday' => esc_html__( 'Friday', 'advanced-local-pickup-for-woocommerce' ), 'saturday' => esc_html__( 'Saturday', 'advanced-local-pickup-for-woocommerce' ), ); $days_bh = array_slice( $all_days_bh, (int) get_option( 'start_of_week' ) ); foreach ( $all_days_bh as $k => $v ) { $days_bh[ $k ] = $v; } $day_short = array( 'sunday' => esc_html__( 'Sun', 'advanced-local-pickup-for-woocommerce' ), 'monday' => esc_html__( 'Mon', 'advanced-local-pickup-for-woocommerce' ), 'tuesday' => esc_html__( 'Tue', 'advanced-local-pickup-for-woocommerce' ), 'wednesday' => esc_html__( 'Wed', 'advanced-local-pickup-for-woocommerce' ), 'thursday' => esc_html__( 'Thu', 'advanced-local-pickup-for-woocommerce' ), 'friday' => esc_html__( 'Fri', 'advanced-local-pickup-for-woocommerce' ), 'saturday' => esc_html__( 'Sat', 'advanced-local-pickup-for-woocommerce' ), ); $send_time_array = array(); for ( $hour = 0; $hour < 24; $hour++ ) { for ( $min = 0; $min < 60; $min = $min + apply_filters( 'alp_work_hours_slots', '30' ) ) { $tt = gmdate( 'H:i', strtotime( "$hour:$min" ) ); $send_time_array[ $tt ] = $tt; } } $fmt_time = function ( $hhmm ) use ( $current_time_fmt ) { if ( '12' === (string) $current_time_fmt ) { return gmdate( 'g:ia', strtotime( $hhmm ) ); } return $hhmm; }; ?>

$val ) : $bh_checked = ( isset( $store_days_data[ $key ]['checked'] ) && 1 == $store_days_data[ $key ]['checked'] ); // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual $pill_class = 'hours-time'; $hour1_start = isset( $store_days_data[ $key ]['wclp_store_hour'] ) ? $store_days_data[ $key ]['wclp_store_hour'] : ''; $hour1_end = isset( $store_days_data[ $key ]['wclp_store_hour_end'] ) ? $store_days_data[ $key ]['wclp_store_hour_end'] : ''; $has_hour1 = ( '' !== $hour1_start && '' !== $hour1_end ); $day_label = isset( $day_short[ $key ] ) ? $day_short[ $key ] : ucfirst( $key ); $date_long = isset( $days_bh[ $key ] ) ? $days_bh[ $key ] : ucfirst( $key ); ?>
–