Function
Setup wizard functions
On this page
- rpress_setup_wizard_steps()
- rpress_setup_wizard_normalize_step()
- rpress_setup_wizard_get_state()
- rpress_setup_wizard_update_state()
- rpress_setup_wizard_progress()
- rpress_setup_wizard_resume_step()
- rpress_setup_wizard_is_complete()
- rpress_setup_wizard_mark_step()
- rpress_setup_wizard_save_step()
- rpress_setup_wizard_skip_step()
- rpress_setup_wizard_text()
- rpress_setup_wizard_amount()
- rpress_setup_wizard_amount_string()
- rpress_setup_wizard_timezone_choice()
- rpress_setup_wizard_has_named_timezone()
- rpress_setup_wizard_save_store()
- rpress_setup_wizard_save_services()
- rpress_setup_wizard_parse_time()
- rpress_setup_wizard_store_time()
- rpress_setup_wizard_get_weekly_hours()
- rpress_setup_wizard_day_names()
- rpress_setup_wizard_core_hours()
- rpress_setup_wizard_save_hours()
- rpress_setup_wizard_core_delivery_fee()
- rpress_setup_wizard_save_delivery()
- rpress_setup_wizard_set_gateway()
- rpress_setup_wizard_test_mode()
- rpress_setup_wizard_save_payments()
- rpress_setup_wizard_save_menu()
- rpress_setup_wizard_save_test()
- rpress_setup_wizard_storefront_url()
- rpress_setup_wizard_live_orders_url()
- rpress_setup_wizard_stripe_needs_keys()
- rpress_setup_wizard_checklist()
- rpress_setup_wizard_render_checklist()
- rpress_setup_wizard_is_fresh_install()
- rpress_setup_wizard_can_redirect()
- rpress_setup_wizard_verify_ajax()
- rpress_setup_wizard_ajax_save()
- rpress_setup_wizard_ajax_checklist()
- rpress_setup_wizard_enqueue()
- rpress_setup_wizard_handle_dismiss()
- rpress_setup_wizard_notice()
- rpress_setup_wizard_page_title()
Functions behind the seven-step setup wizard and its live phone preview.
44 functions. Each entry shows the signature, parameters, return value and where it is defined. Functions marked internal are hook callbacks, screen renderers and other plumbing that extensions normally do not call.
rpress_setup_wizard_steps()#
Returns the ordered list of setup wizard steps keyed by slug.
The slugs are store, services, hours, delivery, payments, menu and test.
rpress_setup_wizard_steps()
Returns array: Step slug => translated label.
Defined in includes/features/setup-wizard/functions.php, line 31.
rpress_setup_wizard_normalize_step()#
Maps a step slug, including legacy onboarding slugs, to a current wizard step slug.
Runs the value through sanitize_key(), translates old slugs such as profile, ordering or golive, and checks the result against rpress_setup_wizard_steps().
rpress_setup_wizard_normalize_step( $step )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$step | string | Required | Step slug, current or legacy. |
Returns string: The wizard step slug, or an empty string when unknown.
Internal. Defined in includes/features/setup-wizard/functions.php, line 50.
rpress_setup_wizard_get_state()#
Returns the saved setup wizard progress with defaults filled in.
Reads the rpress_onboarding option and merges it over defaults: version, status (in_progress), current_step (store), completed_steps, completed_tasks, skipped_tasks and updated_at. The three list keys are always arrays.
rpress_setup_wizard_get_state()
Returns array: Wizard state array.
Example
$state = rpress_setup_wizard_get_state();
if ( 'launched' !== $state['status'] ) {
$resume = $state['current_step'];
}
Defined in includes/features/setup-wizard/functions.php, line 74.
rpress_setup_wizard_update_state()#
Merges changes into the saved wizard progress and stores it.
Sets updated_at to the current time and saves the rpress_onboarding option without autoload.
rpress_setup_wizard_update_state( $changes )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$changes | array | Required | State keys to overwrite. |
Returns array: The new state.
Internal. Defined in includes/features/setup-wizard/functions.php, line 99.
rpress_setup_wizard_progress()#
Returns the wizard steps that are done and the steps that were skipped.
Reads both completed_steps and completed_tasks, maps legacy slugs to current steps, and drops unknown slugs. A step that is both completed and skipped counts only as completed.
rpress_setup_wizard_progress()
Returns array: Array with completed and skipped, each a list of step slugs.
Example
$progress = rpress_setup_wizard_progress();
$done = in_array( 'payments', $progress['completed'], true );
Defined in includes/features/setup-wizard/functions.php, line 112.
rpress_setup_wizard_resume_step()#
Returns the step the wizard should open on.
Uses the saved current step when it is valid. Otherwise returns the first step that is neither completed nor skipped, falling back to test.
rpress_setup_wizard_resume_step()
Returns string: A wizard step slug.
Internal. Defined in includes/features/setup-wizard/functions.php, line 140.
rpress_setup_wizard_is_complete()#
Checks whether the setup wizard has been finished.
True when the saved state status is launched, which is set when the test step is saved.
rpress_setup_wizard_is_complete()
Returns bool: True when the wizard is finished.
Example
if ( ! rpress_setup_wizard_is_complete() ) {
// Show a reminder.
}
Defined in includes/features/setup-wizard/functions.php, line 161.
rpress_setup_wizard_mark_step()#
Records a wizard step as saved or skipped and moves the resume point to the next step.
Saving adds the step to completed_steps and completed_tasks and removes it from skipped_tasks. Skipping only adds it to skipped_tasks. The next step is the one after it in order, or test.
rpress_setup_wizard_mark_step( $step, $skipped = false )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$step | string | Required | Wizard step slug. |
$skipped | bool | false | True when the merchant skipped the step. |
Returns array: The new state.
Internal. Defined in includes/features/setup-wizard/functions.php, line 174.
rpress_setup_wizard_save_step()#
Validates and saves one wizard step through its handler.
Normalizes the slug and calls the matching rpress_setup_wizard_save_{step}() function. On success the step is marked done and the rpress_setup_wizard_step_saved action fires with the step and the data. Saving the test step deletes the rpress_show_setup_wizard option and sets the status to launched. It does not check capabilities.
rpress_setup_wizard_save_step( $step, $data )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$step | string | Required | Wizard step slug. |
$data | array | Required | Raw, unslashed step data. Non-arrays are treated as empty. |
Returns true|WP_Error: True on success, or a WP_Error from an unknown step or the handler.
Example
$result = rpress_setup_wizard_save_step( 'delivery', array(
'flat_delivery_fee' => '3.50',
'minimum_order_price' => '15',
) );
if ( is_wp_error( $result ) ) {
error_log( $result->get_error_message() );
}
Note: Does not check user capability or a nonce; the caller must.
Defined in includes/features/setup-wizard/functions.php, line 211.
rpress_setup_wizard_skip_step()#
Marks a wizard step as skipped without saving any settings.
rpress_setup_wizard_skip_step( $step )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$step | string | Required | Wizard step slug. |
Returns true|WP_Error: True on success, or a WP_Error when the step is unknown.
Internal. Defined in includes/features/setup-wizard/functions.php, line 237.
rpress_setup_wizard_text()#
Reads a sanitized text value from step data.
Returns null when the key is missing or holds an array; otherwise the value cast to string and passed through sanitize_text_field().
rpress_setup_wizard_text( $data, $key )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | Required | Step data. |
$key | string | Required | Key to read. |
Returns string|null: Sanitized text, or null when absent or not a scalar.
Internal. Defined in includes/features/setup-wizard/functions.php, line 253.
rpress_setup_wizard_amount()#
Reads a non-negative amount from step data.
Accepts a comma or dot decimal separator and rounds to two decimals.
rpress_setup_wizard_amount( $data, $key )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | Required | Step data. |
$key | string | Required | Key to read. |
Returns float|null|false: The amount, null when absent or empty, false when not numeric or negative.
Internal. Defined in includes/features/setup-wizard/functions.php, line 267.
rpress_setup_wizard_amount_string()#
Formats an amount as a string the way the settings screen stores it.
Whole numbers lose the decimal part, so 5.0 becomes "5".
rpress_setup_wizard_amount_string( $amount )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$amount | float | Required | Amount. |
Returns string: The amount as a string.
Internal. Defined in includes/features/setup-wizard/functions.php, line 285.
rpress_setup_wizard_timezone_choice()#
Returns the timezone value the wizard select should preselect.
Uses the timezone_string option when set; otherwise builds an offset value such as UTC+5.5 or UTC-3 from gmt_offset, with UTC+0 for zero.
rpress_setup_wizard_timezone_choice()
Returns string: A named timezone or a UTC offset string.
Internal. Defined in includes/features/setup-wizard/functions.php, line 296.
rpress_setup_wizard_has_named_timezone()#
Checks whether the site uses a named, daylight-saving-aware timezone.
False when timezone_string is empty, is UTC, or starts with an Etc/ zone.
rpress_setup_wizard_has_named_timezone()
Returns bool: True for a named city timezone.
Internal. Defined in includes/features/setup-wizard/functions.php, line 314.
rpress_setup_wizard_save_store()#
Saves wizard step 1: restaurant name, contact details, currency, timezone and storefront look.
Validates name, currency and timezone before writing anything. Updates blogname and, if empty, from_name; saves store_phone, store_address, store_city, store_postcode, base_country, base_state, currency, template_pack (classic or modern), primary_color and template (list or grid) in the RestroPress settings; sets timezone_string or gmt_offset and time_format. Keys missing from the data are left unchanged.
rpress_setup_wizard_save_store( $data )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | Required | Step data. |
Returns true|WP_Error: True on success, or a WP_Error for an empty name, unknown currency or invalid timezone.
Internal. Defined in includes/features/setup-wizard/functions.php, line 326.
rpress_setup_wizard_save_services()#
Saves wizard step 2: enabled services, default service, prep time and order alerts.
Requires enable_service to be delivery_and_pickup, delivery or pickup. Stores enable_service, default_service (forced to the single service unless both are on), prep_time (0 to 1440), enable_asap_option, admin_notice_emails (validated, one per line), enable_order_notification and enable_food_type when present in the data.
rpress_setup_wizard_save_services( $data )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | Required | Step data. |
Returns true|WP_Error: True on success, or a WP_Error for an invalid service, prep time or email address.
Internal. Defined in includes/features/setup-wizard/functions.php, line 416.
rpress_setup_wizard_parse_time()#
Parses a time of day into an hour and minute pair.
Delegates to RPRESS_Service_Hours::parse_time() when that class is loaded, so the wizard accepts what the slot engine reads. Otherwise accepts 12-hour values like 9:00am and 24-hour values like 21:30.
rpress_setup_wizard_parse_time( $value )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$value | string | Required | Time string. |
Returns array|null: array( hour, minute ), or null when the value cannot be parsed.
Internal. Defined in includes/features/setup-wizard/functions.php, line 477.
rpress_setup_wizard_store_time()#
Formats an hour and minute pair as stored in the store hours settings.
Output looks like 9:00am or 12:30pm.
rpress_setup_wizard_store_time( $time )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$time | array | Required | array( hour, minute ). |
Returns string: The formatted time.
Internal. Defined in includes/features/setup-wizard/functions.php, line 498.
rpress_setup_wizard_get_weekly_hours()#
Returns the weekly opening hours prepared for the wizard time inputs.
Reads store_hours and falls back to open_time and close_time (or 9:00am and 10:00pm) for missing values. Times are returned as HH:MM, or an empty string when unparseable.
rpress_setup_wizard_get_weekly_hours()
Returns array: Days 1 (Monday) to 7 (Sunday), each with open, close and closed.
Internal. Defined in includes/features/setup-wizard/functions.php, line 509.
rpress_setup_wizard_day_names()#
Returns the translated day names keyed 1 (Monday) to 7 (Sunday).
rpress_setup_wizard_day_names()
Returns array: Day number => day name.
Internal. Defined in includes/features/setup-wizard/functions.php, line 536.
rpress_setup_wizard_core_hours()#
Checks whether core weekly hours are in charge rather than the Store Timing extension.
True when rpress_basic_store_hours_active() does not exist or returns true.
rpress_setup_wizard_core_hours()
Returns bool: True when core hours apply.
Internal. Defined in includes/features/setup-wizard/functions.php, line 554.
rpress_setup_wizard_save_hours()#
Saves wizard step 3: weekly opening hours to store_hours.
Does nothing and returns true when the Store Timing extension owns the schedule. Otherwise each day needs open and close times (different from each other) or must be marked closed; closed days keep their times. Passes the result through rpress_settings_sanitize_store_hours_type() when it exists, saves store_hours, and syncs open_time and close_time to the first open day.
rpress_setup_wizard_save_hours( $data )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | Required | Step data with days[1..7] each holding open, close and closed. |
Returns true|WP_Error: True on success, or a WP_Error when no days are given or a day is incomplete or has identical times.
Internal. Defined in includes/features/setup-wizard/functions.php, line 565.
rpress_setup_wizard_core_delivery_fee()#
Checks whether core prices delivery with the flat fee rather than the Delivery Fee extension.
True when rpress_flat_delivery_fee_active() does not exist or returns true.
rpress_setup_wizard_core_delivery_fee()
Returns bool: True when the flat fee applies.
Internal. Defined in includes/features/setup-wizard/functions.php, line 626.
rpress_setup_wizard_save_delivery()#
Saves wizard step 4: flat delivery fee and minimum order amounts.
Amounts must be numbers of 0 or more. Saves flat_delivery_fee only when core delivery fee is active, plus minimum_order_price and minimum_order_price_pickup, and sets allow_minimum_order to 1 when either minimum is above zero. Zero values are stored as empty strings. Only keys present in the data are written.
rpress_setup_wizard_save_delivery( $data )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | Required | Step data. |
Returns true|WP_Error: True on success, or a WP_Error when an amount is invalid.
Internal. Defined in includes/features/setup-wizard/functions.php, line 637.
rpress_setup_wizard_set_gateway()#
Enables or disables a payment gateway and keeps default_gateway valid.
Edits the gateways setting. When enabling and no valid default exists, the gateway becomes default_gateway. When disabling the default, the first remaining gateway takes over, or the default is cleared.
rpress_setup_wizard_set_gateway( $gateway, $enabled )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$gateway | string | Required | Gateway id, for example cash_on_delivery. |
$enabled | bool | Required | True to enable, false to disable. |
Example
rpress_setup_wizard_set_gateway( 'cash_on_delivery', true );
Defined in includes/features/setup-wizard/functions.php, line 669.
rpress_setup_wizard_test_mode()#
Checks whether the store is in payment test mode.
Uses rpress_is_test_mode() when available, else the test_mode setting.
rpress_setup_wizard_test_mode()
Returns bool: True in test mode.
Internal. Defined in includes/features/setup-wizard/functions.php, line 695.
rpress_setup_wizard_save_payments()#
Saves wizard step 5: gateway switches and Stripe keys for the active mode.
Validates key formats (pk_ for publishable; sk_ or rk_ for secret) and that they match the store's test or live mode. Toggles cash_on_delivery, paypal and stripe via rpress_setup_wizard_set_gateway() when cash_gateway, paypal_enabled or stripe_enabled are present. Saves test_ or live_ publishable_key and secret_key only when a new value is given.
rpress_setup_wizard_save_payments( $data )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | Required | Step data. |
Returns true|WP_Error: True on success, or a WP_Error for a malformed key or a key from the wrong mode.
Internal. Defined in includes/features/setup-wizard/functions.php, line 706.
rpress_setup_wizard_save_menu()#
Records wizard step 6; menu items are created by the importer screens.
rpress_setup_wizard_save_menu( $data )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | Required | Step data, unused. |
Returns true: Always true.
Internal. Defined in includes/features/setup-wizard/functions.php, line 757.
rpress_setup_wizard_save_test()#
Records wizard step 7; finishing never blocks on the checklist.
rpress_setup_wizard_save_test( $data )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | Required | Step data, unused. |
Returns true: Always true.
Internal. Defined in includes/features/setup-wizard/functions.php, line 768.
rpress_setup_wizard_storefront_url()#
Returns the URL of the storefront menu page.
Uses the food_items_page setting if that page is published, then purchase_page, then the home URL.
rpress_setup_wizard_storefront_url()
Returns string: A URL.
Example
$url = rpress_setup_wizard_storefront_url();
Defined in includes/features/setup-wizard/functions.php, line 778.
rpress_setup_wizard_live_orders_url()#
Returns the admin URL of the Live Orders screen.
rpress_setup_wizard_live_orders_url()
Returns string: An admin URL.
Internal. Defined in includes/features/setup-wizard/functions.php, line 794.
rpress_setup_wizard_stripe_needs_keys()#
Checks whether Stripe is enabled but lacks API keys for the active mode.
Needs both the publishable and secret key for the current test or live mode.
rpress_setup_wizard_stripe_needs_keys()
Returns bool: True when Stripe is on and a key is missing.
Internal. Defined in includes/features/setup-wizard/functions.php, line 804.
rpress_setup_wizard_checklist()#
Builds the launch checklist showing what is set and what is still missing.
Checks store name and address, city timezone, opening hours, payment method, Stripe keys (only when Stripe is on without keys), published menu item, published storefront page, alert email, delivery zones (extension case) and a placed order. Filterable through rpress_setup_wizard_checklist.
rpress_setup_wizard_checklist()
Returns array[]: List of items, each with id, label, done, hint, and a step or url.
Example
foreach ( rpress_setup_wizard_checklist() as $item ) {
if ( empty( $item['done'] ) ) {
error_log( 'Missing: ' . $item['id'] );
}
}
Defined in includes/features/setup-wizard/functions.php, line 819.
rpress_setup_wizard_render_checklist()#
Echoes the launch checklist as a list with Fix or Open buttons for missing items.
rpress_setup_wizard_render_checklist( $items )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$items | array[] | Required | Items from rpress_setup_wizard_checklist(). |
Note: Echoes output instead of returning it.
Internal. Defined in includes/features/setup-wizard/functions.php, line 916.
rpress_setup_wizard_is_fresh_install()#
Checks whether this activation is a brand new install with no earlier RestroPress data.
True when neither the rpress_version option nor the wizard state option exists.
rpress_setup_wizard_is_fresh_install()
Returns bool: True for a fresh install.
Note: Call before the install routine writes rpress_version.
Internal. Defined in includes/features/setup-wizard/functions.php, line 948.
rpress_setup_wizard_can_redirect()#
Checks whether a request may be redirected to the wizard after activation.
False for AJAX, cron, REST and WP-CLI requests, the network admin and bulk activation. Otherwise requires the manage_shop_settings capability.
rpress_setup_wizard_can_redirect()
Returns bool: True when the redirect is allowed.
Internal. Defined in includes/features/setup-wizard/functions.php, line 960.
rpress_setup_wizard_verify_ajax()#
Checks capability and nonce for wizard AJAX calls.
Sends a 403 JSON error without manage_shop_settings, then runs check_ajax_referer() with action rpress_onboarding and field nonce.
rpress_setup_wizard_verify_ajax()
Internal. Defined in includes/features/setup-wizard/loader.php, line 33.
rpress_setup_wizard_ajax_save()#
Handles the AJAX request that saves or skips one wizard step.
Reads step, skip and data from POST, then replies with the completed and skipped lists, the launched flag and the checklist. Errors are sent as a 400 JSON error.
rpress_setup_wizard_ajax_save()
Internal. Defined in includes/features/setup-wizard/loader.php, line 45.
rpress_setup_wizard_ajax_checklist()#
Handles the AJAX request that returns the current launch checklist.
rpress_setup_wizard_ajax_checklist()
Internal. Defined in includes/features/setup-wizard/loader.php, line 74.
rpress_setup_wizard_enqueue()#
Enqueues the wizard stylesheet and script strings on the setup and menu import screens.
Only runs when the page query argument is rpress-setup or rpress-menu-import.
rpress_setup_wizard_enqueue()
Internal. Defined in includes/features/setup-wizard/loader.php, line 84.
rpress_setup_wizard_handle_dismiss()#
Stores the per-user dismissal of the setup wizard notice.
Requires manage_shop_settings and a valid rpress_setup_wizard_dismiss nonce, saves user meta rpress_setup_wizard_notice_dismissed, redirects and exits.
rpress_setup_wizard_handle_dismiss()
Internal. Defined in includes/features/setup-wizard/loader.php, line 125.
rpress_setup_wizard_notice()#
Echoes an admin notice inviting stores that have not run the wizard to start it.
Shown on the dashboard and RestroPress screens to users with manage_shop_settings, unless the wizard is complete, the auto-redirect flag is set, the user dismissed it, or the screen is the wizard itself.
rpress_setup_wizard_notice()
Note: Echoes output instead of returning it.
Internal. Defined in includes/features/setup-wizard/loader.php, line 143.
rpress_setup_wizard_page_title()#
Sets a page title for the setup wizard admin page when WordPress found none.
The page has no parent menu, so the global title is empty; this sets it to RestroPress setup.
rpress_setup_wizard_page_title()
Internal. Defined in includes/features/setup-wizard/loader.php, line 179.
