WooCommerce Code Reference

WC_Install
in package

WC_Install Class.

Table of Contents

INITIAL_INSTALLED_VERSION  = 'woocommerce_initial_installed_version'
Option name used to track new installation versions of WooCommerce.
NEWLY_INSTALLED_OPTION  = 'woocommerce_newly_installed'
Option name used to track new installations of WooCommerce.
STORE_ID_OPTION  = 'woocommerce_store_id'
Option name used to uniquely identify installations of WooCommerce.
$db_updates  : array<string|int, mixed>
DB updates and callbacks that need to be run per version.
add_admin_note_after_page_created()  : void
Adds an admin inbox note after a page has been created to notify user. For example to take action to edit the page such as the Refund and returns page.
add_coming_soon_option()  : void
Add the coming soon options for new shops.
background_installer()  : void
Install a plugin from .org in the background via a cron job (used by installer - opt in).
check_version()  : void
Check WooCommerce version and run the updater is required.
create_pages()  : void
Create pages that the plugin relies on, storing page IDs in variables.
create_roles()  : void
Create roles and capabilities.
create_tables()  : array<string|int, mixed>
Set up the database tables which the plugin needs to function.
create_terms()  : void
Add the default terms for WC taxonomies - product types and order statuses. Modify this at your own risk.
cron_schedules()  : array<string|int, mixed>
Add more cron schedules.
delete_obsolete_notes()  : void
Delete obsolete notes.
drop_tables()  : void
Drop WooCommerce tables.
enable_analytics_scheduled_import()  : void
Set scheduled import mode as the default for new installations.
enable_customer_stock_notifications_signups()  : void
Enable customer stock notifications signups by default for new shops.
enable_email_improvements_for_existing_merchants()  : void
Enable email improvements by default for existing shops if conditions are met.
enable_email_improvements_for_newly_installed()  : void
Enable email improvements by default for new shops.
get_core_capabilities()  : array<string|int, mixed>
Get capabilities for WooCommerce - these are assigned to admin/shop manager during installation or reset.
get_db_update_callbacks()  : array<string|int, mixed>
Get list of DB update callbacks.
get_tables()  : array<string|int, mixed>
Return a list of WooCommerce tables. Used to make sure all WC tables are dropped when uninstalling the plugin in a single site or multi site environment.
init()  : void
Hook in tabs.
install()  : void
Install WC.
install_actions()  : void
Install actions when a update button is clicked within the admin area.
is_db_auto_update_enabled()  : bool
Is DB auto-update enabled? This controls whether database updates are applied without prompting the admin.
is_new_install()  : bool
Is this a brand new WC install?
manual_database_update()  : void
Performan manual database update when triggered by WooCommerce System Tools.
maybe_create_pages()  : void
Create pages on installation.
maybe_enable_hpos()  : void
Enable HPOS by default for new shops.
maybe_set_store_id()  : void
Set the Store ID if not already present.
migrate_options()  : void
Migrate option values to their new keys/names.
needs_db_update()  : bool
Is a DB update needed?
page_created()  : void
When pages are created, we might want to take some action.
plugin_action_links()  : array<string|int, mixed>
Show action links on the plugin screen.
plugin_row_meta()  : array<string|int, mixed>
Show row meta on the plugin screen.
remove_mailchimps_redirect()  : void
Removes redirect added during MailChimp plugin's activation.
remove_roles()  : void
Remove WooCommerce roles.
remove_update_db_notice()  : void
Removes the db update notice.
run_manual_database_update()  : void
Run manual database update.
run_update_callback()  : void
Run an update callback when triggered by ActionScheduler.
theme_background_installer()  : void
Install a theme from .org in the background via a cron job (used by installer - opt in).
update_db_version()  : void
Update DB version to current.
verify_base_tables()  : array<string|int, mixed>
Check if all the base tables are present.
wc_admin_db_update_notice()  : void
Add WC Admin based db update notice.
wpmu_drop_tables()  : array<string|int, string>
Uninstall tables when MU blog is deleted.
get_cart_block_content()  : string
Get the Cart block content.
get_checkout_block_content()  : string
Get the Checkout block content.
run_update_callback_end()  : void
Triggered when a callback has ran.
run_update_callback_start()  : void
Triggered when a callback will run.
add_update_db_notice()  : void
Adds the db update notice.
associate_plugin_file()  : array<string|int, mixed>
Get slug from path and associate it with the path.
clear_cron_jobs()  : void
Removes old cron jobs now that we moved to Action Scheduler.
create_files()  : void
Create files/directories.
create_lock()  : bool
Attempts to acquire an installation lock.
create_options()  : void
Default options.
create_placeholder_image()  : void
Create a placeholder image in the media library.
get_order_stats_table_schema()  : string
Get the wc_order_stats table schema.
get_refunds_return_policy_page_content()  : string
Gets the content of the sample refunds and return policy page.
get_schema()  : string
Get Table schema.
install_core()  : void
Core function that performs the WooCommerce install.
maybe_set_activation_transients()  : void
See if we need to set redirect transients for activation or not.
maybe_update_db_version()  : void
See if we need to show or run database updates during install.
release_lock()  : void
Releases the installation lock.
remove_admin_notices()  : void
Reset any notices added to admin.
set_paypal_standard_load_eligibility()  : void
Sets whether PayPal Standard will be loaded on install.
setup_environment()  : void
Setup WC environment - post types, taxonomies, endpoints.
should_enable_hpos_for_new_shop()  : bool
Checks whether HPOS should be enabled for new shops.
update()  : void
Push all needed DB updates to the queue for processing.
update_wc_version()  : void
Update WC version to current.

Constants

INITIAL_INSTALLED_VERSION

Option name used to track new installation versions of WooCommerce.

public string INITIAL_INSTALLED_VERSION = 'woocommerce_initial_installed_version'

NEWLY_INSTALLED_OPTION

Option name used to track new installations of WooCommerce.

public string NEWLY_INSTALLED_OPTION = 'woocommerce_newly_installed'

STORE_ID_OPTION

Option name used to uniquely identify installations of WooCommerce.

public string STORE_ID_OPTION = 'woocommerce_store_id'

Properties

$db_updates

DB updates and callbacks that need to be run per version.

private static array<string|int, mixed> $db_updates = array('2.0.0' => array('wc_update_200_file_paths', 'wc_update_200_permalinks', 'wc_update_200_subcat_display', 'wc_update_200_taxrates', 'wc_update_200_line_items', 'wc_update_200_images', 'wc_update_200_db_version'), '2.0.9' => array('wc_update_209_brazillian_state', 'wc_update_209_db_version'), '2.1.0' => array('wc_update_210_remove_pages', 'wc_update_210_file_paths', 'wc_update_210_db_version'), '2.2.0' => array('wc_update_220_shipping', 'wc_update_220_order_status', 'wc_update_220_variations', 'wc_update_220_attributes', 'wc_update_220_db_version'), '2.3.0' => array('wc_update_230_options', 'wc_update_230_db_version'), '2.4.0' => array('wc_update_240_options', 'wc_update_240_shipping_methods', 'wc_update_240_api_keys', 'wc_update_240_refunds', 'wc_update_240_db_version'), '2.4.1' => array('wc_update_241_variations', 'wc_update_241_db_version'), '2.5.0' => array('wc_update_250_currency', 'wc_update_250_db_version'), '2.6.0' => array('wc_update_260_options', 'wc_update_260_termmeta', 'wc_update_260_zones', 'wc_update_260_zone_methods', 'wc_update_260_refunds', 'wc_update_260_db_version'), '3.0.0' => array('wc_update_300_grouped_products', 'wc_update_300_settings', 'wc_update_300_product_visibility', 'wc_update_300_db_version'), '3.1.0' => array('wc_update_310_downloadable_products', 'wc_update_310_old_comments', 'wc_update_310_db_version'), '3.1.2' => array('wc_update_312_shop_manager_capabilities', 'wc_update_312_db_version'), '3.2.0' => array('wc_update_320_mexican_states', 'wc_update_320_db_version'), '3.3.0' => array('wc_update_330_image_options', 'wc_update_330_webhooks', 'wc_update_330_product_stock_status', 'wc_update_330_set_default_product_cat', 'wc_update_330_clear_transients', 'wc_update_330_set_paypal_sandbox_credentials', 'wc_update_330_db_version'), '3.4.0' => array('wc_update_340_states', 'wc_update_340_state', 'wc_update_340_last_active', 'wc_update_340_db_version'), '3.4.3' => array('wc_update_343_cleanup_foreign_keys', 'wc_update_343_db_version'), '3.4.4' => array('wc_update_344_recreate_roles', 'wc_update_344_db_version'), '3.5.0' => array('wc_update_350_reviews_comment_type', 'wc_update_350_db_version'), '3.5.2' => array('wc_update_352_drop_download_log_fk'), '3.5.4' => array('wc_update_354_modify_shop_manager_caps', 'wc_update_354_db_version'), '3.6.0' => array('wc_update_360_product_lookup_tables', 'wc_update_360_term_meta', 'wc_update_360_downloadable_product_permissions_index', 'wc_update_360_db_version'), '3.7.0' => array('wc_update_370_tax_rate_classes', 'wc_update_370_mro_std_currency', 'wc_update_370_db_version'), '3.9.0' => array('wc_update_390_move_maxmind_database', 'wc_update_390_change_geolocation_database_update_cron', 'wc_update_390_db_version'), '4.0.0' => array('wc_update_product_lookup_tables', 'wc_update_400_increase_size_of_column', 'wc_update_400_reset_action_scheduler_migration_status', 'wc_admin_update_0201_order_status_index', 'wc_admin_update_0230_rename_gross_total', 'wc_admin_update_0251_remove_unsnooze_action', 'wc_update_400_db_version'), '4.4.0' => array('wc_update_440_insert_attribute_terms_for_variable_products', 'wc_admin_update_110_remove_facebook_note', 'wc_admin_update_130_remove_dismiss_action_from_tracking_opt_in_note', 'wc_update_440_db_version'), '4.5.0' => array('wc_update_450_sanitize_coupons_code', 'wc_update_450_db_version'), '5.0.0' => array('wc_update_500_fix_product_review_count', 'wc_admin_update_160_remove_facebook_note', 'wc_admin_update_170_homescreen_layout', 'wc_update_500_db_version'), '5.6.0' => array('wc_update_560_create_refund_returns_page', 'wc_update_560_db_version'), '6.0.0' => array('wc_update_600_migrate_rate_limit_options', 'wc_admin_update_270_delete_report_downloads', 'wc_admin_update_271_update_task_list_options', 'wc_admin_update_280_order_status', 'wc_admin_update_290_update_apperance_task_option', 'wc_admin_update_290_delete_default_homepage_layout_option', 'wc_update_600_db_version'), '6.3.0' => array('wc_update_630_create_product_attributes_lookup_table', 'wc_admin_update_300_update_is_read_from_last_read', 'wc_update_630_db_version'), '6.4.0' => array('wc_update_640_add_primary_key_to_product_attributes_lookup_table', 'wc_admin_update_340_remove_is_primary_from_note_action', 'wc_update_640_db_version'), '6.5.0' => array('wc_update_650_approved_download_directories'), '6.5.1' => array('wc_update_651_approved_download_directories'), '6.7.0' => array('wc_update_670_purge_comments_count_cache', 'wc_update_670_delete_deprecated_remote_inbox_notifications_option'), '7.0.0' => array('wc_update_700_remove_download_log_fk', 'wc_update_700_remove_recommended_marketing_plugins_transient'), '7.2.1' => array('wc_update_721_adjust_new_zealand_states', 'wc_update_721_adjust_ukraine_states'), '7.2.2' => array('wc_update_722_adjust_new_zealand_states', 'wc_update_722_adjust_ukraine_states'), '7.5.0' => array('wc_update_750_add_columns_to_order_stats_table', 'wc_update_750_disable_new_product_management_experience'), '7.7.0' => array('wc_update_770_remove_multichannel_marketing_feature_options'), '7.9.0' => array('wc_update_790_blockified_product_grid_block'), '8.1.0' => array('wc_update_810_migrate_transactional_metadata_for_hpos'), '8.3.0' => array('wc_update_830_rename_checkout_template', 'wc_update_830_rename_cart_template'), '8.6.0' => array('wc_update_860_remove_recommended_marketing_plugins_transient'), '8.7.0' => array('wc_update_870_prevent_listing_of_transient_files_directory'), '8.9.0' => array('wc_update_890_update_connect_to_woocommerce_note', 'wc_update_890_update_paypal_standard_load_eligibility'), '8.9.1' => array('wc_update_891_create_plugin_autoinstall_history_option'), '9.1.0' => array('wc_update_910_add_launch_your_store_tour_option', 'wc_update_910_remove_obsolete_user_meta'), '9.2.0' => array('wc_update_920_add_wc_hooked_blocks_version_option'), '9.3.0' => array('wc_update_930_add_woocommerce_coming_soon_option', 'wc_update_930_migrate_user_meta_for_launch_your_store_tour'), '9.4.0' => array('wc_update_940_add_phone_to_order_address_fts_index', 'wc_update_940_remove_help_panel_highlight_shown'), '9.5.0' => array('wc_update_950_tracking_option_autoload'), '9.6.1' => array('wc_update_961_migrate_default_email_base_color'), '9.8.0' => array('wc_update_980_remove_order_attribution_install_banner_dismissed_option'), '9.8.5' => array('wc_update_985_enable_new_payments_settings_page_feature'), '9.9.0' => array('wc_update_990_remove_wc_count_comments_transient', 'wc_update_990_remove_email_notes'), '10.0.0' => array('wc_update_1000_multisite_visibility_setting', 'wc_update_1000_remove_patterns_toolkit_transient'), '10.2.0' => array('wc_update_1020_add_old_refunded_order_items_to_product_lookup_table'), '10.3.0' => array('wc_update_1030_add_comments_date_type_index'), '10.4.0' => array('wc_update_1040_add_idx_date_paid_status_parent', 'wc_update_1040_cleanup_legacy_ptk_patterns_fetching'), '10.5.0' => array('wc_update_1050_migrate_brand_permalink_setting', 'wc_update_1050_enable_autoload_options', 'wc_update_1050_add_idx_user_email', 'wc_update_1050_remove_deprecated_marketplace_option'), '10.6.0' => array('wc_update_1060_add_woo_idx_comment_approved_type_index'), '10.7.0' => array('wc_update_1070_disable_hpos_sync_on_read'), '10.8.0' => array('wc_update_1080_migrate_analytics_import_option', 'wc_update_1080_backfill_email_template_sync_meta'), '10.8.0-2' => array('wc_update_10802_restore_orders_meta_key_value_index'), '10.9.0' => array('wc_update_1090_remove_task_list_reminder_bar_hidden_option'))

Please note that these functions are invoked when WooCommerce is updated from a previous version, but NOT when WooCommerce is newly installed.

Database schema changes must be incorporated to the SQL returned by get_schema, which is applied via dbDelta at both install and update time. If any other kind of database change is required at install time (e.g. populating tables), use the 'woocommerce_installed' hook.

IMPORTANT: When adding new update callbacks after feature freeze, always use a unique version key with a suffix (e.g. 10.2.0-1) if the base version already exists in the array. This ensures all users, including those on beta or RC versions, receive the update.

Methods

add_admin_note_after_page_created()

Adds an admin inbox note after a page has been created to notify user. For example to take action to edit the page such as the Refund and returns page.

public static add_admin_note_after_page_created() : void
Tags
since
5.6.0
deprecated
10.5.0

No longer used.

Return values
void

add_coming_soon_option()

Add the coming soon options for new shops.

public static add_coming_soon_option() : void

Ensure that the options are set for all shops for performance even if core profiler is disabled on the host.

Tags
since
9.3.0
Return values
void

background_installer()

Install a plugin from .org in the background via a cron job (used by installer - opt in).

public static background_installer(string $plugin_to_install_id, array<string|int, mixed> $plugin_to_install) : void
Parameters
$plugin_to_install_id : string

Plugin ID.

$plugin_to_install : array<string|int, mixed>

Plugin information.

Tags
throws
Exception

If unable to proceed with plugin installation.

since
2.6.0
Return values
void

check_version()

Check WooCommerce version and run the updater is required.

public static check_version() : void

This check is done on all requests and runs if the versions do not match.

Return values
void

create_pages()

Create pages that the plugin relies on, storing page IDs in variables.

public static create_pages() : void
Return values
void

create_tables()

Set up the database tables which the plugin needs to function.

public static create_tables() : array<string|int, mixed>

WARNING: If you are modifying this method, make sure that its safe to call regardless of the state of database.

This is called from install method and is executed in-sync when WC is installed or updated. This can also be called optionally from verify_base_tables.

TODO: Add all crucial tables that we have created from workers in the past.

Tables: woocommerce_attribute_taxonomies - Table for storing attribute taxonomies - these are user defined woocommerce_downloadable_product_permissions - Table for storing user and guest download permissions. KEY(order_id, product_id, download_id) used for organizing downloads on the My Account page woocommerce_order_items - Order line items are stored in a table to make them easily queryable for reports woocommerce_order_itemmeta - Order line item meta is stored in a table for storing extra data. woocommerce_tax_rates - Tax Rates are stored inside 2 tables making tax queries simple and efficient. woocommerce_tax_rate_locations - Each rate can be applied to more than one postcode/city hence the second table.

Return values
array<string|int, mixed>Strings containing the results of the various update queries as returned by dbDelta.

create_terms()

Add the default terms for WC taxonomies - product types and order statuses. Modify this at your own risk.

public static create_terms() : void
Return values
void

cron_schedules()

Add more cron schedules.

public static cron_schedules(array<string|int, mixed> $schedules) : array<string|int, mixed>
Parameters
$schedules : array<string|int, mixed>

List of WP scheduled cron jobs.

Return values
array<string|int, mixed>

delete_obsolete_notes()

Delete obsolete notes.

public static delete_obsolete_notes() : void
Return values
void

enable_analytics_scheduled_import()

Set scheduled import mode as the default for new installations.

public static enable_analytics_scheduled_import() : void

Uses add_option() which only sets the option if it doesn't already exist. This ensures existing installations are not affected.

Tags
since
10.5.0
Return values
void

enable_customer_stock_notifications_signups()

Enable customer stock notifications signups by default for new shops.

public static enable_customer_stock_notifications_signups() : void
Tags
since
0.0.0
Return values
void

enable_email_improvements_for_existing_merchants()

Enable email improvements by default for existing shops if conditions are met.

public static enable_email_improvements_for_existing_merchants() : void
Tags
since
9.9.0
Return values
void

enable_email_improvements_for_newly_installed()

Enable email improvements by default for new shops.

public static enable_email_improvements_for_newly_installed() : void
Tags
since
9.8.0
Return values
void

get_core_capabilities()

Get capabilities for WooCommerce - these are assigned to admin/shop manager during installation or reset.

public static get_core_capabilities() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_db_update_callbacks()

Get list of DB update callbacks.

public static get_db_update_callbacks() : array<string|int, mixed>
Tags
since
3.0.0
Return values
array<string|int, mixed>

get_tables()

Return a list of WooCommerce tables. Used to make sure all WC tables are dropped when uninstalling the plugin in a single site or multi site environment.

public static get_tables() : array<string|int, mixed>
Return values
array<string|int, mixed>WC tables.

install_actions()

Install actions when a update button is clicked within the admin area.

public static install_actions() : void

This function is hooked into admin_init to affect admin only.

Return values
void

is_db_auto_update_enabled()

Is DB auto-update enabled? This controls whether database updates are applied without prompting the admin.

public static is_db_auto_update_enabled() : bool

This is the default behavior since 9.9.0 and can be overridden via filter 'woocommerce_enable_auto_update_db'.

Tags
since
9.9.0
Return values
boolTRUE if database auto-updates are enabled. FALSE otherwise.

is_new_install()

Is this a brand new WC install?

public static is_new_install() : bool

A brand new install has no version yet. Also treat empty installs as 'new'.

Tags
since
3.2.0
Return values
bool

manual_database_update()

Performan manual database update when triggered by WooCommerce System Tools.

public static manual_database_update() : void
Tags
since
3.6.5
Return values
void

maybe_create_pages()

Create pages on installation.

public static maybe_create_pages() : void
Return values
void

maybe_enable_hpos()

Enable HPOS by default for new shops.

public static maybe_enable_hpos() : void
Tags
since
8.2.0
Return values
void

maybe_set_store_id()

Set the Store ID if not already present.

public static maybe_set_store_id() : void
Tags
since
8.4.0
Return values
void

migrate_options()

Migrate option values to their new keys/names.

public static migrate_options() : void
Return values
void

needs_db_update()

Is a DB update needed?

public static needs_db_update() : bool
Tags
since
3.2.0
Return values
bool

page_created()

When pages are created, we might want to take some action.

public static page_created(int $page_id, array<string|int, mixed> $page_data) : void

In this case we want to create an admin note when the refund and returns page is created.

Parameters
$page_id : int

ID of the page.

$page_data : array<string|int, mixed>

The data of the page created.

Tags
since
5.6.0
Return values
void

Show action links on the plugin screen.

public static plugin_action_links(mixed $links) : array<string|int, mixed>
Parameters
$links : mixed

Plugin Action links.

Return values
array<string|int, mixed>

plugin_row_meta()

Show row meta on the plugin screen.

public static plugin_row_meta(mixed $links, mixed $file) : array<string|int, mixed>
Parameters
$links : mixed

Plugin Row Meta.

$file : mixed

Plugin Base file.

Return values
array<string|int, mixed>

remove_mailchimps_redirect()

Removes redirect added during MailChimp plugin's activation.

public static remove_mailchimps_redirect(string $option, string $value) : void
Parameters
$option : string

Option name.

$value : string

Option value.

Return values
void

remove_update_db_notice()

Removes the db update notice.

public static remove_update_db_notice() : void
Tags
since
10.3.0
Return values
void

run_manual_database_update()

Run manual database update.

public static run_manual_database_update() : void
Return values
void

run_update_callback()

Run an update callback when triggered by ActionScheduler.

public static run_update_callback(string $update_callback) : void
Parameters
$update_callback : string

Callback name.

Tags
since
3.6.0
Return values
void

theme_background_installer()

Install a theme from .org in the background via a cron job (used by installer - opt in).

public static theme_background_installer(string $theme_slug) : void
Parameters
$theme_slug : string

Theme slug.

Tags
throws
Exception

If unable to proceed with theme installation.

since
3.1.0
Return values
void

update_db_version()

Update DB version to current.

public static update_db_version([string|null $version = null ]) : void
Parameters
$version : string|null = null

New WooCommerce DB version or null.

Return values
void

verify_base_tables()

Check if all the base tables are present.

public static verify_base_tables([bool $modify_notice = true ][, bool $execute = false ]) : array<string|int, mixed>
Parameters
$modify_notice : bool = true

Whether to modify notice based on if all tables are present.

$execute : bool = false

Whether to execute get_schema queries as well.

Return values
array<string|int, mixed>List of queries.

wc_admin_db_update_notice()

Add WC Admin based db update notice.

public static wc_admin_db_update_notice() : void
Tags
since
4.0.0
deprecated
10.3.0
Return values
void

wpmu_drop_tables()

Uninstall tables when MU blog is deleted.

public static wpmu_drop_tables(array<string|int, mixed> $tables) : array<string|int, string>
Parameters
$tables : array<string|int, mixed>

List of tables that will be deleted by WP.

Return values
array<string|int, string>

get_cart_block_content()

Get the Cart block content.

protected static get_cart_block_content() : string
Tags
since
8.3.0
Return values
string

get_checkout_block_content()

Get the Checkout block content.

protected static get_checkout_block_content() : string
Tags
since
8.3.0
Return values
string

run_update_callback_end()

Triggered when a callback has ran.

protected static run_update_callback_end(string $callback, bool $result) : void
Parameters
$callback : string

Callback name.

$result : bool

Return value from callback. Non-false need to run again.

Tags
since
3.6.0
Return values
void

run_update_callback_start()

Triggered when a callback will run.

protected static run_update_callback_start(string $callback) : void
Parameters
$callback : string

Callback name.

Tags
since
3.6.0
Return values
void

add_update_db_notice()

Adds the db update notice.

private static add_update_db_notice() : void
Tags
since
10.3.0
Return values
void

associate_plugin_file()

Get slug from path and associate it with the path.

private static associate_plugin_file(array<string|int, mixed> $plugins, string $key) : array<string|int, mixed>
Parameters
$plugins : array<string|int, mixed>

Associative array of plugin files to paths.

$key : string

Plugin relative path. Example: woocommerce/woocommerce.php.

Return values
array<string|int, mixed>

clear_cron_jobs()

Removes old cron jobs now that we moved to Action Scheduler.

private static clear_cron_jobs() : void
Return values
void

create_lock()

Attempts to acquire an installation lock.

private static create_lock() : bool
Return values
boolTrue if a lock was acquired, otherwise false.

create_options()

Default options.

private static create_options() : void

Sets up the default options used on the settings page.

Return values
void

create_placeholder_image()

Create a placeholder image in the media library.

private static create_placeholder_image() : void
Tags
since
3.5.0
Return values
void

get_order_stats_table_schema()

Get the wc_order_stats table schema.

private static get_order_stats_table_schema(string $collate) : string
Parameters
$collate : string

Database collation.

Tags
since
10.4.0
Return values
stringSQL schema for wc_order_stats table.

get_refunds_return_policy_page_content()

Gets the content of the sample refunds and return policy page.

private static get_refunds_return_policy_page_content() : string
Tags
since
5.6.0
Return values
stringThe content for the page

get_schema()

Get Table schema.

private static get_schema() : string

See https://github.com/woocommerce/woocommerce/wiki/Database-Description/

A note on indexes; Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that. As of WordPress 4.2, however, we moved to utf8mb4, which uses 4 bytes per character. This means that an index which used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters.

Changing indexes may cause duplicate index notices in logs due to https://core.trac.wordpress.org/ticket/34870 but dropping indexes first causes too much load on some servers/larger DB.

When adding or removing a table, make sure to update the list of tables in WC_Install::get_tables().

Return values
string

install_core()

Core function that performs the WooCommerce install.

private static install_core() : void
Return values
void

maybe_set_activation_transients()

See if we need to set redirect transients for activation or not.

private static maybe_set_activation_transients() : void
Tags
since
4.6.0
Return values
void

maybe_update_db_version()

See if we need to show or run database updates during install.

private static maybe_update_db_version() : void
Tags
since
3.2.0
Return values
void

remove_admin_notices()

Reset any notices added to admin.

private static remove_admin_notices() : void
Tags
since
3.2.0
Return values
void

set_paypal_standard_load_eligibility()

Sets whether PayPal Standard will be loaded on install.

private static set_paypal_standard_load_eligibility() : void
Tags
since
5.5.0
Return values
void

setup_environment()

Setup WC environment - post types, taxonomies, endpoints.

private static setup_environment() : void
Tags
since
3.2.0
Return values
void

should_enable_hpos_for_new_shop()

Checks whether HPOS should be enabled for new shops.

private static should_enable_hpos_for_new_shop() : bool
Return values
bool

update()

Push all needed DB updates to the queue for processing.

private static update() : void
Return values
void

update_wc_version()

Update WC version to current.

private static update_wc_version() : void
Return values
void