wc_importer_current_locale()
Importer current locale.
wc_importer_current_locale() : string
Importer current locale.
wc_importer_current_locale() : string
Add English mapping placeholders when not using English as current language.
wc_importer_default_english_mappings(array<string|int, mixed> $mappings) : array<string|int, mixed>
Importer columns mappings.
Add English special mapping placeholders when not using English as current language.
wc_importer_default_special_english_mappings(array<string|int, mixed> $mappings) : array<string|int, mixed>
Importer columns mappings.
Add generic mappings.
wc_importer_generic_mappings(array<string|int, mixed> $mappings) : array<string|int, mixed>
Importer columns mappings.
Add Shopify mappings.
wc_importer_shopify_mappings(array<string|int, mixed> $mappings, array<string|int, mixed> $raw_headers) : array<string|int, mixed>
Importer columns mappings.
Raw headers from CSV being imported.
Add special wildcard Shopify mappings.
wc_importer_shopify_special_mappings(array<string|int, mixed> $mappings, array<string|int, mixed> $raw_headers) : array<string|int, mixed>
Importer columns mappings.
Raw headers from CSV being imported.
Expand special Shopify columns to WC format.
wc_importer_shopify_expand_data(array<string|int, mixed> $data) : array<string|int, mixed>
Array of data.
Add mappings for WordPress tables.
wc_importer_wordpress_mappings(array<string|int, mixed> $mappings) : array<string|int, mixed>
Importer columns mappings.
Get all WooCommerce screen ids.
wc_get_screen_ids() : array<string|int, mixed>
Get page ID for a specific WC resource.
wc_get_page_screen_id(string $for) : string
Name of the resource.
Create a page and store the ID in an option.
wc_create_page(mixed $slug[, string $option = '' ][, string $page_title = '' ][, string $page_content = '' ], int $post_parent[, string $post_status = 'publish' ]) : int
Slug for the new page.
Option name to store the page's ID.
(default: '') Title for the new page.
(default: '') Content for the new page.
(default: 0) Parent for the new page.
(default: publish) The post status of the new page.
Output admin fields.
woocommerce_admin_fields(array<string|int, mixed> $options) : mixed
Loops through the woocommerce options array and outputs each field.
Opens array to output.
Update all settings which are passed.
woocommerce_update_options(array<string|int, mixed> $options[, array<string|int, mixed> $data = null ]) : mixed
Option fields to save.
Passed data.
Get a setting from the settings API.
woocommerce_settings_get_option(mixed $option_name[, mixed $default = '' ]) : string
Option name to save.
Default value to save.
Sees if line item stock has already reduced stock, and whether those values need adjusting e.g. after changing item qty.
wc_maybe_adjust_line_item_product_stock(WC_Order_Item $item[, int $item_quantity = -1 ]) : bool|array<string|int, mixed>|WP_Error
Item object.
Optional quantity to check against. Read from object if not passed.
Save order items. Uses the CRUD.
wc_save_order_items(int $order_id, array<string|int, mixed> $items) : mixed
Order ID.
Order items to save.
Get HTML for some action buttons. Used in list tables.
wc_render_action_buttons(array<string|int, mixed> $actions) : string
Actions to output.
Shows a notice if variations are missing prices.
wc_render_invalid_variation_notice(WC_Product $product_object) : mixed
Product object.
Output a text input box.
woocommerce_wp_text_input(array<string|int, mixed> $field[, WC_Data $data = null ]) : mixed
Field data.
WC_Data object, will be preferred over post object when passed.
Output a hidden input box.
woocommerce_wp_hidden_input(array<string|int, mixed> $field[, WC_Data $data = null ]) : mixed
Field data.
WC_Data object, will be preferred over post object when passed.
Output a textarea input box.
woocommerce_wp_textarea_input(array<string|int, mixed> $field[, WC_Data $data = null ]) : mixed
Field data.
WC_Data object, will be preferred over post object when passed.
Output a checkbox input box.
woocommerce_wp_checkbox(array<string|int, mixed> $field[, WC_Data $data = null ]) : mixed
Field data.
WC_Data object, will be preferred over post object when passed.
Output a select input box.
woocommerce_wp_select(array<string|int, mixed> $field[, WC_Data $data = null ]) : mixed
Field data.
WC_Data object, will be preferred over post object when passed.
Output a radio input box.
woocommerce_wp_radio(array<string|int, mixed> $field[, WC_Data $data = null ]) : mixed
Field data.
WC_Data object, will be preferred over post object when passed.
Output a note.
woocommerce_wp_note(array<string|int, mixed> $field) : mixed
Field data.
Returns core WC pages to connect to WC-Admin.
wc_admin_get_core_pages_to_connect() : array<string|int, mixed>
Filter breadcrumbs for core pages that aren't explicitly connected.
wc_admin_filter_core_page_breadcrumbs(array<string|int, mixed> $breadcrumbs) : array<string|int, mixed>
Breadcrumb pieces.
Render the WC-Admin header bar on all WooCommerce core pages.
wc_admin_connect_core_pages(bool $is_connected, bool $current_page) : bool
Whether the current page is connected.
The current page, if connected.
Format a number using the decimal and thousands separator settings in WooCommerce.
wc_admin_number_format(mixed $number) : string
Number to be formatted.
Retrieves a URL to relative path inside WooCommerce admin with the provided query parameters.
wc_admin_url([string $path = null ][, array<string|int, mixed> $query = array() ]) : string
Relative path of the desired page.
Query parameters to append to the path.
wc_admin_get_feature_config() : mixed
Connect an existing page to WooCommerce Admin.
wc_admin_connect_page(array<string|int, mixed> $options) : mixed
Passthrough to PageController::connect_page().
Options for PageController::connect_page().
Register JS-powered WooCommerce Admin Page.
wc_admin_register_page(array<string|int, mixed> $options) : mixed
Passthrough to PageController::register_page().
Options for PageController::register_page().
Is this page connected to WooCommerce Admin? Passthrough to PageController::is_connected_page().
wc_admin_is_connected_page() : bool
Is this a WooCommerce Admin Page? Passthrough to PageController::is_registered_page().
wc_admin_is_registered_page() : bool
Get breadcrumbs for WooCommerce Admin Page navigation.
wc_admin_get_breadcrumbs() : array<string|int, mixed>
Passthrough to PageController::get_breadcrumbs().
Update order stats `status` index length.
wc_admin_update_0201_order_status_index() : mixed
See: https://github.com/woocommerce/woocommerce-admin/issues/2969.
Rename "gross_total" to "total_sales".
wc_admin_update_0230_rename_gross_total() : mixed
See: https://github.com/woocommerce/woocommerce-admin/issues/3175
Remove the note unsnoozing scheduled action.
wc_admin_update_0251_remove_unsnooze_action() : mixed
Remove Facebook Extension note.
wc_admin_update_110_remove_facebook_note() : mixed
Remove Dismiss action from tracking opt-in admin note.
wc_admin_update_130_remove_dismiss_action_from_tracking_opt_in_note() : mixed
Update DB Version.
wc_admin_update_130_db_version() : mixed
Update DB Version.
wc_admin_update_140_db_version() : mixed
Remove Facebook Experts note.
wc_admin_update_160_remove_facebook_note() : mixed
Set "two column" homescreen layout as default for existing stores.
wc_admin_update_170_homescreen_layout() : mixed
Delete the preexisting export files.
wc_admin_update_270_delete_report_downloads() : mixed
Update the old task list options.
wc_admin_update_271_update_task_list_options() : mixed
Update order stats `status`.
wc_admin_update_280_order_status() : mixed
Update the old task list options.
wc_admin_update_290_update_apperance_task_option() : mixed
Delete the old woocommerce_default_homepage_layout option.
wc_admin_update_290_delete_default_homepage_layout_option() : mixed
Use woocommerce_admin_activity_panel_inbox_last_read from the user meta to set wc_admin_notes.is_read col.
wc_admin_update_300_update_is_read_from_last_read() : mixed
Delete "is_primary" column from the wc_admin_notes table.
wc_admin_update_340_remove_is_primary_from_note_action() : mixed
Delete the deprecated remote inbox notifications option since transients are now used.
wc_update_670_delete_deprecated_remote_inbox_notifications_option() : mixed
Returns the url to the lost password endpoint url.
wc_lostpassword_url([string $default_url = '' ]) : string
Default lost password URL.
Get the link to the edit account details page.
wc_customer_edit_account_url() : string
Get the edit address slug translation.
wc_edit_address_i18n(string $id[, bool $flip = false ]) : string
Address ID.
Flip the array to make it possible to retrieve the values ​​from both sides.
Get My Account menu items.
wc_get_account_menu_items() : array<string|int, mixed>
Get account menu item classes.
wc_get_account_menu_item_classes(string $endpoint) : string
Endpoint.
Get account endpoint URL.
wc_get_account_endpoint_url(string $endpoint) : string
Endpoint.
Get My Account > Orders columns.
wc_get_account_orders_columns() : array<string|int, mixed>
Get My Account > Downloads columns.
wc_get_account_downloads_columns() : array<string|int, mixed>
Get My Account > Payment methods columns.
wc_get_account_payment_methods_columns() : array<string|int, mixed>
Get My Account > Payment methods types
wc_get_account_payment_methods_types() : array<string|int, mixed>
Get account orders actions.
wc_get_account_orders_actions(int|WC_Order $order) : array<string|int, mixed>
Order instance or ID.
Get account formatted address.
wc_get_account_formatted_address([string $address_type = 'billing' ], int $customer_id) : string
Type of address; 'billing' or 'shipping'.
Customer ID. Defaults to 0.
Returns an array of a user's saved payments list for output on the account tab.
wc_get_account_saved_payment_methods_list(array<string|int, mixed> $list, int $customer_id) : array<string|int, mixed>
List of payment methods passed from wc_get_customer_saved_methods_list().
The customer to fetch payment methods for.
Controls the output for credit cards on the my account page.
wc_get_account_saved_payment_methods_list_item_cc(array<string|int, mixed> $item, WC_Payment_Token $payment_token) : array<string|int, mixed>
Individual list item from woocommerce_saved_payment_methods_list.
The payment token associated with this method entry.
Controls the output for eChecks on the my account page.
wc_get_account_saved_payment_methods_list_item_echeck(array<string|int, mixed> $item, WC_Payment_Token $payment_token) : array<string|int, mixed>
Individual list item from woocommerce_saved_payment_methods_list.
The payment token associated with this method entry.
Gets text attributes from a string.
wc_get_text_attributes(string $raw_attributes) : array<string|int, mixed>
Raw attributes.
See if an attribute is actually valid.
wc_get_text_attributes_filter_callback(string $value) : bool
Value.
Implode an array of attributes using WC_DELIMITER.
wc_implode_text_attributes(array<string|int, mixed> $attributes) : string
Attributes list.
Get attribute taxonomies.
wc_get_attribute_taxonomies() : array<string|int, mixed>
Get (cached) attribute taxonomy ID and name pairs.
wc_get_attribute_taxonomy_ids() : array<string|int, mixed>
Get (cached) attribute taxonomy label and name pairs.
wc_get_attribute_taxonomy_labels() : array<string|int, mixed>
Get a product attribute name.
wc_attribute_taxonomy_name(string $attribute_name) : string
Attribute name.
Get the attribute name used when storing values in post meta.
wc_variation_attribute_name(string $attribute_name) : string
Attribute name.
Get a product attribute name by ID.
wc_attribute_taxonomy_name_by_id(int $attribute_id) : string
Attribute ID.
Get a product attribute ID by name.
wc_attribute_taxonomy_id_by_name(string $name) : int
Attribute name.
Get a product attributes label.
wc_attribute_label(string $name[, WC_Product $product = '' ]) : string
Attribute name.
Product data.
Get a product attributes orderby setting.
wc_attribute_orderby(string $name) : string
Attribute name.
Get an array of product attribute taxonomies.
wc_get_attribute_taxonomy_names() : array<string|int, mixed>
Get attribute types.
wc_get_attribute_types() : array<string|int, mixed>
Check if there are custom attribute types.
wc_has_custom_attribute_types() : bool
Get attribute type label.
wc_get_attribute_type_label(string $type) : string
Attribute type slug.
Check if attribute name is reserved.
wc_check_if_attribute_name_is_reserved(string $attribute_name) : bool
https://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms.
Attribute name.
Callback for array filter to get visible only.
wc_attributes_array_filter_visible(WC_Product_Attribute $attribute) : bool
Attribute data.
Callback for array filter to get variation attributes only.
wc_attributes_array_filter_variation(WC_Product_Attribute $attribute) : bool
Attribute data.
Check if an attribute is included in the attributes area of a variation name.
wc_is_attribute_in_product_name(string $attribute, string $name) : bool
Attribute value to check for.
Product name to check in.
Callback for array filter to get default attributes. Will allow for '0' string values, but regard all other class PHP FALSE equivalents normally.
wc_array_filter_default_attributes(mixed $attribute) : bool
Attribute being considered for exclusion from parent array.
Get attribute data by ID.
wc_get_attribute(int $id) : stdClass|null
Attribute ID.
Create attribute.
wc_create_attribute(array<string|int, mixed> $args) : int|WP_Error
Attribute arguments { Array of attribute parameters.
@type int $id Unique identifier, used to update an attribute.
@type string $name Attribute name. Always required.
@type string $slug Attribute alphanumeric identifier.
@type string $type Type of attribute.
Core by default accepts: 'select' and 'text'.
Default to 'select'.
@type string $order_by Sort order.
Accepts: 'menu_order', 'name', 'name_num' and 'id'.
Default to 'menu_order'.
@type bool $has_archives Enable or disable attribute archives. False by default.
}
Update an attribute.
wc_update_attribute(int $id, array<string|int, mixed> $args) : int|WP_Error
For available args see wc_create_attribute().
Attribute ID.
Attribute arguments.
Delete attribute by ID.
wc_delete_attribute(int $id) : bool
Attribute ID.
Get an unprefixed product attribute name.
wc_attribute_taxonomy_slug(string $attribute_name) : string
Attribute name.
Prevent password protected products being added to the cart.
wc_protected_product_add_to_cart(bool $passed, int $product_id) : bool
Validation.
Product ID.
Clears the cart session when called.
wc_empty_cart() : mixed
Load the persistent cart.
wc_load_persistent_cart(string $user_login, WP_User $user) : mixed
User login.
User data.
Retrieves unvalidated referer from '_wp_http_referer' or HTTP referer.
wc_get_raw_referer() : string|false
Do not use for redirects, use {@see} instead.
Add to cart messages.
wc_add_to_cart_message(int|array<string|int, mixed> $products[, bool $show_qty = false ][, bool $return = false ]) : mixed
Product ID list or single product ID.
Should quantities be shown? Added in 2.6.0.
Return message rather than add it.
Comma separate a list of item names, and replace final comma with 'and'.
wc_format_list_of_items(array<string|int, mixed> $items) : string
Cart items.
Clear cart after payment.
wc_clear_cart_after_payment() : mixed
Get the subtotal.
wc_cart_totals_subtotal_html() : mixed
Get shipping methods.
wc_cart_totals_shipping_html() : mixed
Get taxes total.
wc_cart_totals_taxes_total_html() : mixed
Get a coupon label.
wc_cart_totals_coupon_label(string|WC_Coupon $coupon[, bool $echo = true ]) : string
Coupon data or code.
Echo or return.
Get coupon display HTML.
wc_cart_totals_coupon_html(string|WC_Coupon $coupon) : mixed
Coupon data or code.
Get order total html including inc tax if needed.
wc_cart_totals_order_total_html() : mixed
Get the fee value.
wc_cart_totals_fee_html(object $fee) : mixed
Fee data.
Get a shipping methods full label including price.
wc_cart_totals_shipping_method_label(WC_Shipping_Rate $method) : string
Shipping method rate data.
Round discount.
wc_cart_round_discount(float $value, int $precision) : float
Amount to round.
DP to round.
Gets chosen shipping method IDs from chosen_shipping_methods session, without instance IDs.
wc_get_chosen_shipping_method_ids() : array<string|int, string>
Get chosen method for package from session.
wc_get_chosen_shipping_method_for_package(int $key, array<string|int, mixed> $package) : string|bool
Key of package.
Package data array.
Choose the default method for a package.
wc_get_default_shipping_method_for_package(int $key, array<string|int, mixed> $package, string $chosen_method) : string
Key of package.
Package data array.
Chosen shipping method. e.g. flat_rate:1.
See if the methods have changed since the last request.
wc_shipping_methods_have_changed(int $key, array<string|int, mixed> $package) : bool
Key of package.
Package data array.
Gets a hash of important product data that when changed should cause cart items to be invalidated.
wc_get_cart_item_data_hash(WC_Product $product) : string
The woocommerce_cart_item_data_to_validate filter can be used to add custom properties.
Product object.
Is_woocommerce - Returns true if on a page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and thus are not included).
is_woocommerce() : bool
Is_shop - Returns true when viewing the product type archive (shop).
is_shop() : bool
Is_product_taxonomy - Returns true when viewing a product taxonomy archive.
is_product_taxonomy() : bool
Is_product_category - Returns true when viewing a product category.
is_product_category([string $term = '' ]) : bool
(default: '') The term slug your checking for. Leave blank to return true on any.
Is_product_tag - Returns true when viewing a product tag.
is_product_tag([string $term = '' ]) : bool
(default: '') The term slug your checking for. Leave blank to return true on any.
Is_product - Returns true when viewing a single product.
is_product() : bool
Is_cart - Returns true when viewing the cart page.
is_cart() : bool
Is_checkout - Returns true when viewing the checkout page, or when processing AJAX requests for updating or processing the checkout.
is_checkout() : bool
Is_checkout_pay - Returns true when viewing the checkout's pay page.
is_checkout_pay_page() : bool
Is_wc_endpoint_url - Check if an endpoint is showing.
is_wc_endpoint_url([string|false $endpoint = false ]) : bool
Whether endpoint.
Is_account_page - Returns true when viewing an account page.
is_account_page() : bool
Is_view_order_page - Returns true when on the view order page.
is_view_order_page() : bool
Check for edit account page.
is_edit_account_page() : bool
Returns true when viewing the edit account page.
Is_order_received_page - Returns true when viewing the order received page.
is_order_received_page() : bool
Is_add_payment_method_page - Returns true when viewing the add payment method page.
is_add_payment_method_page() : bool
Is_lost_password_page - Returns true when viewing the lost password page.
is_lost_password_page() : bool
Is_ajax - Returns true when the page is loaded via ajax.
is_ajax() : bool
Is_store_notice_showing - Returns true when store notice is active.
is_store_notice_showing() : bool
Is_filtered - Returns true when filtering products using layered nav or price sliders.
is_filtered() : bool
Returns true when the passed taxonomy name is a product attribute.
taxonomy_is_product_attribute(string $name) : bool
of the attribute.
Returns true when the passed meta name is a product attribute.
meta_is_product_attribute(string $name, string $value, int $product_id) : bool
of the attribute.
of the attribute.
to check for attribute.
Are store-wide taxes enabled?
wc_tax_enabled() : bool
Is shipping enabled?
wc_shipping_enabled() : bool
Are prices inclusive of tax?
wc_prices_include_tax() : bool
Simple check for validating a URL, it must start with http:// or https://.
wc_is_valid_url(string $url) : bool
and pass FILTER_VALIDATE_URL validation.
to check.
Check if the home URL is https. If it is, we don't need to do things such as 'force ssl'.
wc_site_is_https() : bool
Check if the checkout is configured for https. Look at options, WP HTTPS plugin, or the permalink itself.
wc_checkout_is_https() : bool
Checks whether the content passed contains a specific short code.
wc_post_content_has_shortcode([string $tag = '' ]) : bool
Shortcode tag to check.
Check if reviews are enabled.
wc_reviews_enabled() : bool
Check if reviews ratings are enabled.
wc_review_ratings_enabled() : bool
Check if review ratings are required.
wc_review_ratings_required() : bool
Check if a CSV file is valid.
wc_is_file_valid_csv(string $file[, bool $check_path = true ]) : bool
File name.
If should check for the path.
Check if the current theme is a block theme.
wc_current_theme_is_fse_theme() : bool
Check if the current theme has WooCommerce support or is a FSE theme.
wc_current_theme_supports_woocommerce_or_fse() : bool
Given an element name, returns a class name.
wc_wp_theme_get_element_class_name(string $element) : string
If the WP-related function is not defined or current theme is not a FSE theme, return empty string.
The name of the element.
Given an element name, returns true or false depending on whether the current theme has styles for that element defined in theme.json.
wc_block_theme_has_styles_for_element(string $element) : bool
If the theme is not a block theme or the WP-related function is not defined, return false.
The name of the element.
Define a constant if it is not already defined.
wc_maybe_define_constant(string $name, mixed $value) : mixed
Constant name.
Value.
Create a new order programmatically.
wc_create_order([array<string|int, mixed> $args = array() ]) : WC_Order|WP_Error
Returns a new order object on success which can then be used to add additional data.
Order arguments.
Update an order. Uses wc_create_order.
wc_update_order(array<string|int, mixed> $args) : WC_Order|WP_Error
Order arguments.
Given a path, this will convert any of the subpaths into their corresponding tokens.
wc_tokenize_path(string $path, array<string|int, mixed> $path_tokens) : string
The absolute path to tokenize.
An array keyed with the token, containing paths that should be replaced.
Given a tokenized path, this will expand the tokens to their full path.
wc_untokenize_path(string $path, array<string|int, mixed> $path_tokens) : string
The absolute path to expand.
An array keyed with the token, containing paths that should be expanded.
Fetches an array containing all of the configurable path constants to be used in tokenization.
wc_get_path_define_tokens() : array<string|int, mixed>
Get template part (for templates like the shop-loop).
wc_get_template_part(mixed $slug[, string $name = '' ]) : mixed
WC_TEMPLATE_DEBUG_MODE will prevent overrides in themes from taking priority.
Template slug.
Template name (default: '').
Get other templates (e.g. product attributes) passing attributes and including the file.
wc_get_template(string $template_name[, array<string|int, mixed> $args = array() ][, string $template_path = '' ][, string $default_path = '' ]) : mixed
Template name.
Arguments. (default: array).
Template path. (default: '').
Default path. (default: '').
Like wc_get_template, but returns the HTML instead of outputting.
wc_get_template_html(string $template_name[, array<string|int, mixed> $args = array() ][, string $template_path = '' ][, string $default_path = '' ]) : string
Template name.
Arguments. (default: array).
Template path. (default: '').
Default path. (default: '').
Locate a template and return the path for inclusion.
wc_locate_template(string $template_name[, string $template_path = '' ][, string $default_path = '' ]) : string
This is the load order:
yourtheme/$template_path/$template_name yourtheme/$template_name $default_path/$template_name
Template name.
Template path. (default: '').
Default path. (default: '').
Add a template to the template cache.
wc_set_template_cache(string $cache_key, string $template) : mixed
Object cache key.
Located template.
Clear the template cache.
wc_clear_template_cache() : mixed
Get Base Currency Code.
get_woocommerce_currency() : string
Get full list of currency codes.
get_woocommerce_currencies() : array<string|int, mixed>
Currency symbols and names should follow the Unicode CLDR recommendation (https://cldr.unicode.org/translation/currency-names-and-symbols)
Get all available Currency symbols.
get_woocommerce_currency_symbols() : array<string|int, mixed>
Currency symbols and names should follow the Unicode CLDR recommendation (https://cldr.unicode.org/translation/currency-names-and-symbols)
Get Currency symbol.
get_woocommerce_currency_symbol([string $currency = '' ]) : string
Currency symbols and names should follow the Unicode CLDR recommendation (https://cldr.unicode.org/translation/currency-names-and-symbols)
Currency. (default: '').
Send HTML emails from WooCommerce.
wc_mail(mixed $to, mixed $subject, mixed $message[, string $headers = "Content-Type: text/html
" ][, string $attachments = '' ]) : bool
Receiver.
Subject.
Message.
Headers. (default: "Content-Type: text/html\r\n").
Attachments. (default: "").
Return "theme support" values from the current theme, if set.
wc_get_theme_support([string $prop = '' ][, mixed $default = null ]) : mixed
Name of prop (or key::subkey for arrays of props) if you want a specific value. Leave blank to get all props as an array.
Optional value to return if the theme does not declare support for a prop.
Get an image size by name or defined dimensions.
wc_get_image_size(array<string|int, mixed>|string $image_size) : array<string|int, mixed>
The returned variable is filtered by woocommerce_get_image_size_{image_size} filter to allow 3rd party customisation.
Sizes defined by the theme take priority over settings. Settings are hidden when a theme defines sizes.
Name of the image size to get, or an array of dimensions.
Queue some JavaScript code to be output in the footer.
wc_enqueue_js(string $code) : mixed
Code.
Output any queued javascript code in the footer.
wc_print_js() : mixed
Set a cookie - wrapper for setcookie using WP constants.
wc_setcookie(string $name, string $value, int $expire[, bool $secure = false ][, bool $httponly = false ]) : mixed
Name of the cookie being set.
Value of the cookie.
Expiry of the cookie.
Whether the cookie should be served only over https.
Whether the cookie is only accessible over HTTP, not scripting languages like JavaScript. @since 3.6.0.
Get the URL to the WooCommerce Legacy REST API.
get_woocommerce_api_url(string $path) : string
Note that as of WooCommerce 9.0 the WooCommerce Legacy REST API has been moved to a dedicated extension, and the implementation of its root endpoint in WooCommerce core is now just a stub that will always return an error. See the setup_legacy_api_stub method in includes/class-woocommerce.php and: https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/
an endpoint to include in the URL.
Recursively get page children.
wc_get_page_children(int $page_id) : array<string|int, int>
Page ID.
Flushes rewrite rules when the shop page (or it's children) gets saved.
flush_rewrite_rules_on_shop_page_save() : mixed
Various rewrite rule fixes.
wc_fix_rewrite_rules(array<string|int, mixed> $rules) : array<string|int, mixed>
Rules.
Prevent product attachment links from breaking when using complex rewrite structures.
wc_fix_product_attachment_link(string $link, int $post_id) : string
Link.
Post ID.
Protect downloads from ms-files.php in multisite.
wc_ms_protect_download_rewite_rules(string $rewrite) : string
rewrite rules.
Formats a string in the format COUNTRY:STATE into an array.
wc_format_country_state_string(string $country_string) : array<string|int, mixed>
Country string.
Get the store's base location.
wc_get_base_location() : array<string|int, mixed>
Get the customer's default location.
wc_get_customer_default_location() : array<string|int, mixed>
Filtered, and set to base location or left blank. If cache-busting, this should only be used when 'location' is set in the querystring.
Get user agent string.
wc_get_user_agent() : string
Generate a rand hash.
wc_rand_hash() : string
WC API - Hash.
wc_api_hash(string $data) : string
Message to be hashed.
Find all possible combinations of values from the input array and return in a logical order.
wc_array_cartesian(array<string|int, mixed> $input) : array<string|int, mixed>
Input.
Run a MySQL transaction query, if supported.
wc_transaction_query([string $type = 'start' ][, bool $force = false ]) : mixed
Types: start (default), commit, rollback.
use of transactions.
Gets the url to the cart page.
wc_get_cart_url() : string
Gets the url to the checkout page.
wc_get_checkout_url() : string
Register a shipping method.
woocommerce_register_shipping_method(string|object $shipping_method) : mixed
class name (string) or a class object.
Get the shipping zone matching a given package from the cart.
wc_get_shipping_zone(array<string|int, mixed> $package) : WC_Shipping_Zone
Shipping package.
Get a nice name for credit card providers.
wc_get_credit_card_type_label(string $type) : string
Provider Slug/Type.
Outputs a "back" link so admin screens can easily jump back a page.
wc_back_link(string $label, string $url) : mixed
Title of the page to return to.
URL of the page to return to.
Display a WooCommerce help tip.
wc_help_tip(string $tip[, bool $allow_html = false ]) : string
Help tip text.
Allow sanitized HTML if true or escape.
Return a list of potential postcodes for wildcard searching.
wc_get_wildcard_postcodes(string $postcode[, string $country = '' ]) : array<string|int, string>
Postcode.
Country to format postcode for matching.
Used by shipping zones and taxes to compare a given $postcode to stored postcodes to find matches for numerical ranges, and wildcards.
wc_postcode_location_matcher(string $postcode, array<string|int, mixed> $objects, string $object_id_key, string $object_compare_key[, string $country = '' ]) : array<string|int, mixed>
Postcode you want to match against stored postcodes.
Array of postcode objects from Database.
DB column name for the ID.
DB column name for the value.
Country from which this postcode belongs. Allows for formatting.
Gets number of shipping methods currently enabled. Used to identify if shipping is configured.
wc_get_shipping_method_count([bool $include_legacy = false ][, bool $enabled_only = false ]) : int
Count legacy shipping methods too.
Whether non-legacy shipping methods should be restricted to enabled ones. It doesn't affect legacy shipping methods. @since 4.3.0.
Wrapper for set_time_limit to see if it is enabled.
wc_set_time_limit(int $limit) : mixed
Time limit.
Wrapper for nocache_headers which also disables page caching.
wc_nocache_headers() : mixed
Used to sort products attributes with uasort.
wc_product_attribute_uasort_comparison(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
First attribute to compare.
Second attribute to compare.
Used to sort shipping zone methods with uasort.
wc_shipping_zone_method_order_uasort_comparison(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
First shipping zone method to compare.
Second shipping zone method to compare.
User to sort checkout fields based on priority with uasort.
wc_checkout_fields_uasort_comparison(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
First field to compare.
Second field to compare.
User to sort two values with ausort.
wc_uasort_comparison(int $a, int $b) : int
First value to compare.
Second value to compare.
Sort values based on ascii, usefull for special chars in strings.
wc_ascii_uasort_comparison(string $a, string $b) : int
First value.
Second value.
Sort array according to current locale rules and maintaining index association.
wc_asort_by_locale(array<string|int, mixed> &$data[, string $locale = '' ]) : array<string|int, mixed>
By default tries to use Collator from PHP Internationalization Functions if available.
If PHP Collator class doesn't exists it fallback to removing accepts from a array
and by sorting with uasort( $data, 'strcmp' )
giving support for ASCII values.
List of values to sort.
Locale.
Get rounding mode for internal tax calculations.
wc_get_tax_rounding_mode() : int
Get rounding precision for internal WC calculations.
wc_get_rounding_precision() : int
Will return the value of wc_get_price_decimals increased by 2 decimals, with WC_ROUNDING_PRECISION being the minimum.
Add precision to a number by moving the decimal point to the right as many places as indicated by wc_get_price_decimals().
wc_add_number_precision(float|null $value[, bool $round = true ]) : int|float
Optionally the result is rounded so that the total number of digits equals wc_get_rounding_precision() plus one.
Number to add precision to.
If the result should be rounded.
Remove precision from a number and return a float.
wc_remove_number_precision(float $value) : float
Number to add precision to.
Add precision to an array of number and return an array of int.
wc_add_number_precision_deep(array<string|int, mixed> $value[, bool $round = true ]) : int|array<string|int, mixed>
Number to add precision to.
Should we round after adding precision?.
Remove precision from an array of number and return an array of int.
wc_remove_number_precision_deep(array<string|int, mixed> $value) : int|array<string|int, mixed>
Number to add precision to.
Get a shared logger instance.
wc_get_logger() : WC_Logger_Interface
Use the woocommerce_logging_class filter to change the logging class. You may provide one of the following:
- a class name which will be instantiated as new $class
with no arguments
- an instance which will be used directly as the logger
In either case, the class or instance must implement WC_Logger_Interface.
Trigger logging cleanup using the logging class.
wc_cleanup_logs() : mixed
Prints human-readable information about a variable.
wc_print_r(mixed $expression[, bool $return = false ]) : string|bool
Some server environments block some debugging functions. This function provides a safe way to turn an expression into a printable, readable form without calling blocked functions.
The expression to be printed.
Optional. Default false. Set to true to return the human-readable string.
Based on wp_list_pluck, this calls a method instead of returning a property.
wc_list_pluck(array<string|int, mixed> $list, int|string $callback_or_field[, int|string $index_key = null ]) : array<string|int, mixed>
List of objects or arrays.
Callback method from the object to place instead of the entire object.
Optional. Field from the object to use as keys for the new array. Default null.
Get permalink settings for things like products and taxonomies.
wc_get_permalink_structure() : array<string|int, mixed>
As of 3.3.0, the permalink settings are stored to the option instead of being blank and inheritting from the locale. This speeds up page loading times by negating the need to switch locales on each page load.
This is more inline with WP core behavior which does not localize slugs.
Switch WooCommerce to site language.
wc_switch_to_site_locale() : mixed
Switch WooCommerce language to original.
wc_restore_locale() : mixed
Convert plaintext phone number to clickable phone number.
wc_make_phone_clickable(string $phone) : string
Remove formatting and allow "+". Example and specs: https://developer.mozilla.org/en/docs/Web/HTML/Element/a#Creating_a_phone_link
Content to convert phone number.
Get an item of post data if set, otherwise return a default value.
wc_get_post_data_by_key(string $key[, string $default = '' ]) : mixed
Meta key.
Default value.
Get data if set, otherwise return a default value or null. Prevents notices when data is not set.
wc_get_var(mixed &$var[, string $default = null ]) : mixed
Variable.
Default value.
Read in WooCommerce headers when reading plugin headers.
wc_enable_wc_plugin_headers(array<string|int, mixed> $headers) : array<string|int, mixed>
Headers.
Prevent auto-updating the WooCommerce plugin on major releases if there are untested extensions active.
wc_prevent_dangerous_auto_updates(bool $should_update, object $plugin) : bool
If should update.
Plugin data.
Delete expired transients.
wc_delete_expired_transients() : int
Deletes all expired transients. The multi-table delete syntax is used. to delete the transient record from table a, and the corresponding. transient_timeout record from table b.
Based on code inside core's upgrade_network() function.
Make a URL relative, if possible.
wc_get_relative_url(string $url) : string
URL to make relative.
See if a resource is remote.
wc_is_external_resource(string $url) : bool
URL to check.
See if theme/s is activate or not.
wc_is_active_theme(string|array<string|int, mixed> $theme) : bool
Theme name or array of theme names to check.
Is the site using a default WP theme?
wc_is_wp_default_theme_active() : bool
Cleans up session data - cron callback.
wc_cleanup_session_data() : mixed
Convert a decimal (e.g. 3.5) to a fraction (e.g. 7/2).
wc_decimal_to_fraction(float $decimal) : array<string|int, mixed>|bool
From: https://www.designedbyaturtle.co.uk/2015/converting-a-decimal-to-a-fraction-in-php/
the decimal number.
Round discount.
wc_round_discount(float $value, int $precision) : float
Amount to round.
DP to round.
Return the html selected attribute if stringified $value is found in array of stringified $options or if stringified $value is the same as scalar stringified $options.
wc_selected(string|int $value, string|int|array<string|int, mixed> $options) : string
Value to find within options.
Options to go through when looking for value.
Retrieves the MySQL server version. Based on $wpdb.
wc_get_server_database_version() : array<string|int, mixed>
Initialize and load the cart functionality.
wc_load_cart() : void
Test whether the context of execution comes from async action scheduler.
wc_is_running_from_async_action_scheduler() : bool
Polyfill for wp_cache_get_multiple for WP versions before 5.5.
wc_cache_get_multiple(array<string|int, mixed> $keys[, string $group = '' ][, bool $force = false ]) : array<string|int, mixed>|bool
Array of keys to get from group.
Optional. Where the cache contents are grouped. Default empty.
Optional. Whether to force an update of the local cache from the persistent cache. Default false.
Get coupon types.
wc_get_coupon_types() : array<string|int, mixed>
Get a coupon type's name.
wc_get_coupon_type([string $type = '' ]) : string
Coupon type.
Coupon types that apply to individual products. Controls which validation rules will apply.
wc_get_product_coupon_types() : array<string|int, mixed>
Coupon types that apply to the cart as a whole. Controls which validation rules will apply.
wc_get_cart_coupon_types() : array<string|int, mixed>
Check if coupons are enabled.
wc_coupons_enabled() : bool
Filterable.
Get coupon code by ID.
wc_get_coupon_code_by_id(int $id) : string
Coupon ID.
Get coupon ID by code.
wc_get_coupon_id_by_code(string $code, int $exclude) : int
Coupon code.
Used to exclude an ID from the check if you're checking existence.
Runs a deprecated action with notice only if used.
wc_do_deprecated_action(string $tag, array<string|int, mixed> $args, string $version[, string $replacement = null ][, string $message = null ]) : mixed
The name of the action hook.
Array of additional function arguments to be passed to do_action().
The version of WooCommerce that deprecated the hook.
The hook that should have been used.
A message regarding the change.
Wrapper for deprecated functions so we can apply some extra logic.
wc_deprecated_function(string $function, string $version[, string $replacement = null ]) : mixed
Function used.
Version the message was added in.
Replacement for the called function.
Wrapper for deprecated hook so we can apply some extra logic.
wc_deprecated_hook(string $hook, string $version[, string $replacement = null ][, string $message = null ]) : mixed
The hook that was used.
The version of WordPress that deprecated the hook.
The hook that should have been used.
A message regarding the change.
When catching an exception, this allows us to log it if unexpected.
wc_caught_exception(Exception $exception_object[, string $function = '' ][, array<string|int, mixed> $args = array() ]) : mixed
The exception object.
The function which threw exception.
The args passed to the function.
Wrapper for _doing_it_wrong().
wc_doing_it_wrong(string $function, string $message, string $version) : mixed
Function used.
Message to log.
Version the message was added in.
Wrapper for deprecated arguments so we can apply some extra logic.
wc_deprecated_argument(string $argument, string $version[, mixed $message = null ]) : mixed
woocommerce_show_messages() : mixed
woocommerce_weekend_area_js() : mixed
woocommerce_tooltip_js() : mixed
woocommerce_datepicker_js() : mixed
woocommerce_admin_scripts() : mixed
woocommerce_create_page(mixed $slug[, mixed $option = '' ][, mixed $page_title = '' ][, mixed $page_content = '' ], mixed $post_parent) : mixed
woocommerce_readfile_chunked(mixed $file[, mixed $retbytes = true ]) : mixed
Formal total costs - format to the number of decimal places for the base currency.
woocommerce_format_total(mixed $number) : string
Get product name with extra details such as SKU price and attributes. Used within admin.
woocommerce_get_formatted_product_name(WC_Product $product) : string
Handle IPN requests for the legacy paypal gateway by calling gateways manually if needed.
woocommerce_legacy_paypal_ipn() : mixed
get_product([mixed $the_product = false ][, mixed $args = array() ]) : mixed
woocommerce_protected_product_add_to_cart(mixed $passed, mixed $product_id) : mixed
woocommerce_empty_cart() : mixed
woocommerce_load_persistent_cart(mixed $user_login, mixed $user) : mixed
woocommerce_add_to_cart_message(mixed $product_id) : mixed
woocommerce_clear_cart_after_payment() : mixed
woocommerce_cart_totals_subtotal_html() : mixed
woocommerce_cart_totals_shipping_html() : mixed
woocommerce_cart_totals_coupon_html(mixed $coupon) : mixed
woocommerce_cart_totals_order_total_html() : mixed
woocommerce_cart_totals_fee_html(mixed $fee) : mixed
woocommerce_cart_totals_shipping_method_label(mixed $method) : mixed
woocommerce_get_template_part(mixed $slug[, mixed $name = '' ]) : mixed
woocommerce_get_template(mixed $template_name[, mixed $args = array() ][, mixed $template_path = '' ][, mixed $default_path = '' ]) : mixed
woocommerce_locate_template(mixed $template_name[, mixed $template_path = '' ][, mixed $default_path = '' ]) : mixed
woocommerce_mail(mixed $to, mixed $subject, mixed $message[, mixed $headers = "Content-Type: text/html
" ][, mixed $attachments = "" ]) : mixed
woocommerce_disable_admin_bar(mixed $show_admin_bar) : mixed
woocommerce_create_new_customer(mixed $email[, mixed $username = '' ][, mixed $password = '' ]) : mixed
woocommerce_set_customer_auth_cookie(mixed $customer_id) : mixed
woocommerce_update_new_customer_past_orders(mixed $customer_id) : mixed
woocommerce_paying_customer(mixed $order_id) : mixed
woocommerce_customer_bought_product(mixed $customer_email, mixed $user_id, mixed $product_id) : mixed
woocommerce_customer_has_capability(mixed $allcaps, mixed $caps, mixed $args) : mixed
woocommerce_sanitize_taxonomy_name(mixed $taxonomy) : mixed
woocommerce_get_filename_from_url(mixed $file_url) : mixed
woocommerce_get_dimension(mixed $dim, mixed $to_unit) : mixed
woocommerce_get_weight(mixed $weight, mixed $to_unit) : mixed
woocommerce_trim_zeros(mixed $price) : mixed
woocommerce_round_tax_total(mixed $tax) : mixed
woocommerce_format_decimal(mixed $number[, mixed $dp = false ][, mixed $trim_zeros = false ]) : mixed
woocommerce_clean(mixed $var) : mixed
woocommerce_array_overlay(mixed $a1, mixed $a2) : mixed
woocommerce_price(mixed $price[, mixed $args = array() ]) : mixed
woocommerce_let_to_num(mixed $size) : mixed
woocommerce_date_format() : mixed
woocommerce_time_format() : mixed
woocommerce_timezone_string() : mixed
woocommerce_rgb_from_hex(mixed $color) : mixed
woocommerce_hex_darker(mixed $color[, mixed $factor = 30 ]) : mixed
woocommerce_hex_lighter(mixed $color[, mixed $factor = 30 ]) : mixed
woocommerce_light_or_dark(mixed $color[, mixed $dark = '#000000' ][, mixed $light = '#FFFFFF' ]) : mixed
woocommerce_format_hex(mixed $hex) : mixed
woocommerce_get_order_id_by_order_key(mixed $order_key) : mixed
woocommerce_downloadable_file_permission(mixed $download_id, mixed $product_id, mixed $order) : mixed
woocommerce_downloadable_product_permissions(mixed $order_id) : mixed
woocommerce_add_order_item(mixed $order_id, mixed $item) : mixed
woocommerce_delete_order_item(mixed $item_id) : mixed
woocommerce_update_order_item_meta(mixed $item_id, mixed $meta_key, mixed $meta_value[, mixed $prev_value = '' ]) : mixed
woocommerce_add_order_item_meta(mixed $item_id, mixed $meta_key, mixed $meta_value[, mixed $unique = false ]) : mixed
woocommerce_delete_order_item_meta(mixed $item_id, mixed $meta_key[, mixed $meta_value = '' ][, mixed $delete_all = false ]) : mixed
woocommerce_get_order_item_meta(mixed $item_id, mixed $key[, mixed $single = true ]) : mixed
woocommerce_cancel_unpaid_orders() : mixed
woocommerce_processing_order_count() : mixed
woocommerce_get_page_id(mixed $page) : mixed
woocommerce_get_endpoint_url(mixed $endpoint[, mixed $value = '' ][, mixed $permalink = '' ]) : mixed
woocommerce_lostpassword_url(mixed $url) : mixed
woocommerce_customer_edit_account_url() : mixed
woocommerce_nav_menu_items(mixed $items, mixed $args) : mixed
woocommerce_nav_menu_item_classes(mixed $menu_items, mixed $args) : mixed
woocommerce_list_pages(mixed $pages) : mixed
woocommerce_product_dropdown_categories([mixed $args = array() ][, mixed $deprecated_hierarchical = 1 ][, mixed $deprecated_show_uncategorized = 1 ][, mixed $deprecated_orderby = '' ]) : mixed
woocommerce_walk_category_dropdown_tree([mixed $a1 = '' ][, mixed $a2 = '' ][, mixed $a3 = '' ]) : mixed
woocommerce_taxonomy_metadata_wpdbfix() : mixed
wc_taxonomy_metadata_wpdbfix() : mixed
woocommerce_order_terms(mixed $the_term, mixed $next_id, mixed $taxonomy, mixed $index[, mixed $terms = null ]) : mixed
woocommerce_set_term_order(mixed $term_id, mixed $index, mixed $taxonomy[, mixed $recursive = false ]) : mixed
woocommerce_terms_clauses(mixed $clauses, mixed $taxonomies, mixed $args) : mixed
_woocommerce_term_recount(mixed $terms, mixed $taxonomy, mixed $callback, mixed $terms_are_term_taxonomy_ids) : mixed
woocommerce_recount_after_stock_change(mixed $product_id) : mixed
woocommerce_change_term_counts(mixed $terms, mixed $taxonomies, mixed $args) : mixed
woocommerce_get_product_ids_on_sale() : mixed
woocommerce_get_featured_product_ids() : mixed
woocommerce_get_product_terms(mixed $object_id, mixed $taxonomy[, mixed $fields = 'all' ]) : mixed
woocommerce_product_post_type_link(mixed $permalink, mixed $post) : mixed
woocommerce_placeholder_img_src() : mixed
woocommerce_placeholder_img([mixed $size = 'woocommerce_thumbnail' ]) : mixed
woocommerce_get_formatted_variation([mixed $variation = '' ][, mixed $flat = false ]) : mixed
woocommerce_scheduled_sales() : mixed
woocommerce_get_attachment_image_attributes(mixed $attr) : mixed
woocommerce_prepare_attachment_for_js(mixed $response) : mixed
woocommerce_track_product_view() : mixed
woocommerce_compile_less_styles() : mixed
woocommerce_calc_shipping was an option used to determine if shipping was enabled prior to version 2.6.0. This has since been replaced with wc_shipping_enabled() function and the woocommerce_ship_to_countries setting.
woocommerce_calc_shipping_backwards_compatibility(mixed $value) : string
woocommerce_get_product_schema() : string
Save product price.
_wc_save_product_price(int $product_id, float $regular_price[, float $sale_price = '' ][, string $date_from = '' ][, string $date_to = '' ]) : mixed
This is a private function (internal use ONLY) used until a data manipulation api is built.
Return customer avatar URL.
wc_get_customer_avatar_url(string $email) : string
the customer's email.
WooCommerce Core Supported Themes.
wc_get_core_supported_themes() : array<string|int, string>
Get min/max price meta query args.
wc_get_min_max_price_meta_query(array<string|int, mixed> $args) : array<string|int, mixed>
Min price and max price arguments.
When a term is split, ensure meta data maintained.
wc_taxonomy_metadata_update_content_for_split_terms(int $old_term_id, int $new_term_id, string $term_taxonomy_id, string $taxonomy) : mixed
Old term ID.
New term ID.
Term taxonomy ID.
Taxonomy.
WooCommerce Term Meta API.
update_woocommerce_term_meta(int $term_id, string $meta_key, mixed $meta_value[, string $prev_value = '' ]) : bool
WC tables for storing term meta are deprecated from WordPress 4.4 since 4.4 has its own table. This function serves as a wrapper, using the new table if present, or falling back to the WC table.
Term ID.
Meta key.
Meta value.
Previous value. (default: '').
WooCommerce Term Meta API.
add_woocommerce_term_meta(int $term_id, string $meta_key, mixed $meta_value[, bool $unique = false ]) : bool
WC tables for storing term meta are deprecated from WordPress 4.4 since 4.4 has its own table. This function serves as a wrapper, using the new table if present, or falling back to the WC table.
Term ID.
Meta key.
Meta value.
Make meta key unique. (default: false).
WooCommerce Term Meta API
delete_woocommerce_term_meta(int $term_id, string $meta_key[, mixed $meta_value = '' ][, bool $deprecated = false ]) : bool
WC tables for storing term meta are deprecated from WordPress 4.4 since 4.4 has its own table. This function serves as a wrapper, using the new table if present, or falling back to the WC table.
Term ID.
Meta key.
Meta value (default: '').
Deprecated param (default: false).
WooCommerce Term Meta API
get_woocommerce_term_meta(int $term_id, string $key[, bool $single = true ]) : mixed
WC tables for storing term meta are deprecated from WordPress 4.4 since 4.4 has its own table. This function serves as a wrapper, using the new table if present, or falling back to the WC table.
Term ID.
Meta key.
Whether to return a single value. (default: true).
Registers the default log handler.
wc_register_default_log_handler([array<string|int, mixed> $handlers = array() ]) : array<string|int, mixed>
Handlers.
Get a log file path.
wc_get_log_file_path(string $handle) : string
name.
Get a log file name.
wc_get_log_file_name(string $handle) : string
Name.
Converts a string (e.g. 'yes' or 'no') to a bool.
wc_string_to_bool(string|bool $string) : bool
String to convert. If a bool is passed it will be returned as-is.
Converts a bool to a 'yes' or 'no'.
wc_bool_to_string(bool|string $bool) : string
Bool to convert. If a string is passed it will first be converted to a bool.
Explode a string into an array by $delimiter and remove empty values.
wc_string_to_array(string $string[, string $delimiter = ',' ]) : array<string|int, mixed>
String to convert.
Delimiter, defaults to ','.
Sanitize taxonomy names. Slug format (no spaces, lowercase).
wc_sanitize_taxonomy_name(string $taxonomy) : string
Urldecode is used to reverse munging of UTF8 characters.
Taxonomy name.
Sanitize permalink values before insertion into DB.
wc_sanitize_permalink(string $value) : string
Cannot use wc_clean because it sometimes strips % chars and breaks the user's setting.
Permalink.
Gets the filename part of a download URL.
wc_get_filename_from_url(string $file_url) : string
File URL.
Normalise dimensions, unify to cm then convert to wanted unit value.
wc_get_dimension(int|float $dimension, string $to_unit[, string $from_unit = '' ]) : float
Usage: wc_get_dimension( 55, 'in' ); wc_get_dimension( 55, 'in', 'm' );
Dimension.
Unit to convert to. Options: 'in', 'mm', 'cm', 'm'.
Unit to convert from. Defaults to ''. Options: 'in', 'mm', 'cm', 'm'.
Normalise weights, unify to kg then convert to wanted unit value.
wc_get_weight(int|float $weight, string $to_unit[, string $from_unit = '' ]) : float
Usage: wc_get_weight(55, 'kg'); wc_get_weight(55, 'kg', 'lbs');
Weight.
Unit to convert to. Options: 'g', 'kg', 'lbs', 'oz'.
Unit to convert from. Defaults to ''. Options: 'g', 'kg', 'lbs', 'oz'.
Trim trailing zeros off prices.
wc_trim_zeros(string|float|int $price) : string
Price.
Round a tax amount.
wc_round_tax_total(float $value[, int $precision = null ]) : float
Amount to round.
DP to round. Defaults to wc_get_price_decimals.
Round half down in PHP 5.2.
wc_legacy_round_half_down(float $value, int $precision) : float
Value to round.
Precision to round down to.
Make a refund total negative.
wc_format_refund_total(float $amount) : float
Refunded amount.
Format decimal numbers ready for DB storage.
wc_format_decimal(float|string $number[, mixed $dp = false ][, bool $trim_zeros = false ]) : string
Sanitize, optionally remove decimals, and optionally round + trim off zeros.
This function does not remove thousands - this should be done before passing a value to the function.
Expects either a float or a string with a decimal separator only (no thousands).
number Number of decimal points to use, blank to use woocommerce_price_num_decimals, or false to avoid all rounding.
From end of string.
Convert a float to a string without locale formatting which PHP adds when changing floats to strings.
wc_float_to_string(float $float) : string
Float value to format.
Format a price with WC Currency Locale settings.
wc_format_localized_price(string $value) : string
Price to localize.
Format a decimal with the decimal separator for prices or PHP Locale settings.
wc_format_localized_decimal(string $value) : string
Decimal to localize.
Format a coupon code.
wc_format_coupon_code(string $value) : string
Coupon code to format.
Sanitize a coupon code.
wc_sanitize_coupon_code(string $value) : string
Uses sanitize_post_field since coupon codes are stored as post_titles - the sanitization and escaping must match.
Due to the unfiltered_html captability that some (admin) users have, we need to account for slashes.
Coupon code to format.
Clean variables using sanitize_text_field. Arrays are cleaned recursively.
wc_clean(string|array<string|int, mixed> $var) : string|array<string|int, mixed>
Non-scalar values are ignored.
Data to sanitize.
Function wp_check_invalid_utf8 with recursive array support.
wc_check_invalid_utf8(string|array<string|int, mixed> $var) : string|array<string|int, mixed>
Data to sanitize.
Run wc_clean over posted textarea but maintain line breaks.
wc_sanitize_textarea(string $var) : string
Data to sanitize.
Sanitize a string destined to be a tooltip.
wc_sanitize_tooltip(string $var) : string
Data to sanitize.
Merge two arrays.
wc_array_overlay(array<string|int, mixed> $a1, array<string|int, mixed> $a2) : array<string|int, mixed>
First array to merge.
Second array to merge.
Formats a stock amount by running it through a filter.
wc_stock_amount(int|float $amount) : int|float
Stock amount.
Get the price format depending on the currency position.
get_woocommerce_price_format() : string
Return the thousand separator for prices.
wc_get_price_thousand_separator() : string
Return the decimal separator for prices.
wc_get_price_decimal_separator() : string
Return the number of decimals after the decimal point.
wc_get_price_decimals() : int
Format the price with a currency symbol.
wc_price(float $price[, array<string|int, mixed> $args = array() ]) : string
Raw price.
Arguments to format a price { Array of arguments. Defaults to empty array.
@type bool $ex_tax_label Adds exclude tax label.
Defaults to false.
@type string $currency Currency code.
Defaults to empty string (Use the result from get_woocommerce_currency()).
@type string $decimal_separator Decimal separator.
Defaults the result of wc_get_price_decimal_separator().
@type string $thousand_separator Thousand separator.
Defaults the result of wc_get_price_thousand_separator().
@type string $decimals Number of decimals.
Defaults the result of wc_get_price_decimals().
@type string $price_format Price format depending on the currency position.
Defaults the result of get_woocommerce_price_format().
}
Notation to numbers.
wc_let_to_num(string $size) : int
This function transforms the php.ini notation for numbers (like '2M') to an integer.
Size value.
WooCommerce Date Format - Allows to change date format for everything WooCommerce.
wc_date_format() : string
WooCommerce Time Format - Allows to change time format for everything WooCommerce.
wc_time_format() : string
Convert mysql datetime to PHP timestamp, forcing UTC. Wrapper for strtotime.
wc_string_to_timestamp(string $time_string[, int|null $from_timestamp = null ]) : int
Based on wcs_strtotime_dark_knight() from WC Subscriptions by Prospress.
Time string.
Timestamp to convert from.
Convert a date string to a WC_DateTime.
wc_string_to_datetime(string $time_string) : WC_DateTime
Time string.
WooCommerce Timezone - helper to retrieve the timezone string for a site until.
wc_timezone_string() : string
a WP core method exists (see https://core.trac.wordpress.org/ticket/24730).
Adapted from https://secure.php.net/manual/en/function.timezone-name-from-abbr.php#89155.
Get timezone offset in seconds.
wc_timezone_offset() : float
Callback which can flatten post meta (gets the first value if it's an array).
wc_flatten_meta_callback(array<string|int, mixed> $value) : mixed
Value to flatten.
Convert RGB to HEX.
wc_rgb_from_hex(mixed $color) : array<string|int, mixed>
Color.
Make HEX color darker.
wc_hex_darker(mixed $color[, int $factor = 30 ]) : string
Color.
Darker factor. Defaults to 30.
Make HEX color lighter.
wc_hex_lighter(mixed $color[, int $factor = 30 ]) : string
Color.
Lighter factor. Defaults to 30.
Determine whether a hex color is light.
wc_hex_is_light(mixed $color) : bool
Color.
Detect if we should use a light or dark color on a background color.
wc_light_or_dark(mixed $color[, string $dark = '#000000' ][, string $light = '#FFFFFF' ]) : string
Color.
Darkest reference. Defaults to '#000000'.
Lightest reference. Defaults to '#FFFFFF'.
Format string as hex.
wc_format_hex(string $hex) : string|null
HEX color.
Format the postcode according to the country and length of the postcode.
wc_format_postcode(string $postcode, string $country) : string
Unformatted postcode.
Base country.
Normalize postcodes.
wc_normalize_postcode(string $postcode) : string
Remove spaces and convert characters to uppercase.
Postcode.
Format phone numbers.
wc_format_phone_number(string $phone) : string
Phone number.
Sanitize phone number.
wc_sanitize_phone_number(string $phone) : string
Allows only numbers and "+" (plus sign).
Phone number.
Wrapper for mb_strtoupper which see's if supported first.
wc_strtoupper(string $string) : string
String to format.
Make a string lowercase.
wc_strtolower(string $string) : string
Try to use mb_strtolower() when available.
String to format.
Trim a string and append a suffix.
wc_trim_string(string $string[, int $chars = 200 ][, string $suffix = '...' ]) : string
String to trim.
Amount of characters. Defaults to 200.
Suffix. Defaults to '...'.
Format content to display shortcodes.
wc_format_content(string $raw_string) : string
Raw string.
Format product short description.
wc_format_product_short_description(string $content) : string
Adds support for Jetpack Markdown.
Product short description.
Formats curency symbols when saved in settings.
wc_format_option_price_separators(string $value, array<string|int, mixed> $option, string $raw_value) : string
Option value.
Option name.
Raw value.
Formats decimals when saved in settings.
wc_format_option_price_num_decimals(string $value, array<string|int, mixed> $option, string $raw_value) : string
Option value.
Option name.
Raw value.
Formats hold stock option and sets cron event up.
wc_format_option_hold_stock_minutes(string $value, array<string|int, mixed> $option, string $raw_value) : string
Option value.
Option name.
Raw value.
Sanitize terms from an attribute text based.
wc_sanitize_term_text_based(string $term) : string
Term value.
Make numeric postcode.
wc_make_numeric_postcode(string $postcode) : string
Converts letters to numbers so we can do a simple range check on postcodes. E.g. PE30 becomes 16050300 (P = 16, E = 05, 3 = 03, 0 = 00)
Regular postcode.
Format the stock amount ready for display based on settings.
wc_format_stock_for_display(WC_Product $product) : string
Product object for which the stock you need to format.
Format the stock quantity ready for display.
wc_format_stock_quantity_for_display(int $stock_quantity, WC_Product $product) : string
Stock quantity.
Product instance so that we can pass through the filters.
Format a sale price for display.
wc_format_sale_price(string $regular_price, string $sale_price) : string
Regular price.
Sale price.
Format a price range for display.
wc_format_price_range(string $from, string $to) : string
Price from.
Price to.
Format a weight for display.
wc_format_weight(float $weight) : string
Weight.
Format dimensions for display.
wc_format_dimensions(array<string|int, mixed> $dimensions) : string
Array of dimensions.
Format a date for output.
wc_format_datetime(WC_DateTime $date[, string $format = '' ]) : string
Instance of WC_DateTime.
Data format. Defaults to the wc_date_format function if not set.
Process oEmbeds.
wc_do_oembeds(string $content) : string
Content.
Get part of a string before :.
wc_get_string_before_colon(string $string) : string
Used for example in shipping methods ids where they take the format method_id:instance_id
String to extract.
Array merge and sum function.
wc_array_merge_recursive_numeric() : array<string|int, mixed>
Source: https://gist.github.com/Nickology/f700e319cbafab5eaedc
Implode and escape HTML attributes for output.
wc_implode_html_attributes(array<string|int, mixed> $raw_attributes) : string
Attribute name value pairs.
Escape JSON for use on HTML or attribute text nodes.
wc_esc_json(string $json[, bool $html = false ]) : string
JSON to escape.
True if escaping for HTML text node, false for attributes. Determines how quotes are handled.
Parse a relative date option from the settings API into a standard format.
wc_parse_relative_date_option(mixed $raw_value) : array<string|int, mixed>
Value stored in DB.
Format the endpoint slug, strip out anything not allowed in a url.
wc_sanitize_endpoint_slug(string $raw_value) : string
The raw value.
Get the count of notices added, either for all notices (default) or for one.
wc_notice_count([string $notice_type = '' ]) : int
particular notice type specified by $notice_type.
Optional. The name of the notice type - either error, success or notice.
Check if a notice has already been added.
wc_has_notice(string $message[, string $notice_type = 'success' ]) : bool
The text to display in the notice.
Optional. The name of the notice type - either error, success or notice.
Add and store a notice.
wc_add_notice(string $message[, string $notice_type = 'success' ][, array<string|int, mixed> $data = array() ]) : mixed
The text to display in the notice.
Optional. The name of the notice type - either error, success or notice.
Optional notice data.
Set all notices at once.
wc_set_notices(array<string|int, array<string|int, mixed>> $notices) : mixed
Array of notices.
Unset all notices.
wc_clear_notices() : mixed
Prints messages and errors which are stored in the session, then clears them.
wc_print_notices([bool $return = false ]) : string|void
true to return rather than echo. @since 3.5.0.
Print a single notice immediately.
wc_print_notice(string $message[, string $notice_type = 'success' ][, array<string|int, mixed> $data = array() ][, bool $return = false ]) : mixed
The text to display in the notice.
Optional. The singular name of the notice type - either error, success or notice.
Optional notice data. @since 3.9.0.
true to return rather than echo. @since 7.7.0.
Returns all queued notices, optionally filtered by a notice type.
wc_get_notices([string $notice_type = '' ]) : array<string|int, array<string|int, mixed>>
Optional. The singular name of the notice type - either error, success or notice.
Add notices for WP Errors.
wc_add_wp_error_notices(WP_Error $errors) : mixed
Errors.
Filters out the same tags as wp_kses_post, but allows tabindex for <a> element.
wc_kses_notice(string $message) : string
Content to filter through kses.
Get notice data attribute.
wc_get_notice_data_attr(array<string|int, mixed> $notice) : string
Notice data.
Standard way of retrieving orders based on certain parameters.
wc_get_orders(array<string|int, mixed> $args) : array<string|int, WC_Order>|stdClass
This function should be used for order retrieval so that when we move to custom tables, functions still work.
Args and usage: https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query
Array of args (above).
Main function for returning orders, uses the WC_Order_Factory class.
wc_get_order([mixed $the_order = false ]) : bool|WC_Order|WC_Order_Refund
Post object or post ID of the order.
Get all order statuses.
wc_get_order_statuses() : array<string|int, mixed>
See if a string is an order status.
wc_is_order_status(string $maybe_status) : bool
Status, including any wc- prefix.
Get list of statuses which are consider 'paid'.
wc_get_is_paid_statuses() : array<string|int, mixed>
Get list of statuses which are consider 'pending payment'.
wc_get_is_pending_statuses() : array<string|int, mixed>
Get the nice name for an order status.
wc_get_order_status_name(string $status) : string
Status.
Generate an order key with prefix.
wc_generate_order_key([string $key = '' ]) : string
Order key without a prefix. By default generates a 13 digit secret.
Finds an Order ID based on an order key.
wc_get_order_id_by_order_key(string $order_key) : int
An order key has generated by.
Get all registered order types.
wc_get_order_types([string $for = '' ]) : array<string|int, mixed>
Optionally define what you are getting order types for so only relevant types are returned. e.g. for 'order-meta-boxes', 'order-count'.
Get an order type by post type name.
wc_get_order_type(string $type) : bool|array<string|int, mixed>
Post type name.
Register order type. Do not use before init.
wc_register_order_type(string $type[, array<string|int, mixed> $args = array() ]) : bool
Wrapper for register post type, as well as a method of telling WC which. post types are types of orders, and having them treated as such.
$args are passed to register_post_type, but there are a few specific to this function: - add_order_meta_boxes (bool) Whether or not the order type gets shop_order meta boxes. - exclude_from_order_count (bool) Whether or not this order type is excluded from counts. - exclude_from_order_views (bool) Whether or not this order type is visible by customers when. viewing orders e.g. on the my account page. - exclude_from_order_reports (bool) Whether or not to exclude this type from core reports. - exclude_from_order_sales_reports (bool) Whether or not to exclude this type from core sales reports.
Post type. (max. 20 characters, can not contain capital letters or spaces).
An array of arguments.
Return the count of processing orders.
wc_processing_order_count() : int
Return the orders count of a specific order status.
wc_orders_count(string $status[, string $type = '' ]) : int
Status.
(Optional) Order type. Leave empty to include all 'for order-count' order types. @{see wc_get_order_types()}.
Grant downloadable product access to the file identified by $download_id.
wc_downloadable_file_permission(string $download_id, int|WC_Product $product, WC_Order $order[, int $qty = 1 ][, WC_Order_Item $item = null ]) : int|bool
File identifier.
Product instance or ID.
Order data.
Quantity purchased.
Item of the order.
Order Status completed - give downloadable product access to customer.
wc_downloadable_product_permissions(int $order_id[, bool $force = false ]) : mixed
Order ID.
Force downloadable permissions.
Clear all transients cache for order data.
wc_delete_shop_order_transients(int|WC_Order $order) : mixed
Order instance or ID.
See if we only ship to billing addresses.
wc_ship_to_billing_address_only() : bool
Create a new order refund programmatically.
wc_create_refund([array<string|int, mixed> $args = array() ]) : WC_Order_Refund|WP_Error
Returns a new refund object on success which can then be used to add additional data.
New refund arguments.
Try to refund the payment for an order via the gateway.
wc_refund_payment(WC_Order $order, string $amount[, string $reason = '' ]) : bool|WP_Error
Order instance.
Amount to refund.
Refund reason.
Restock items during refund.
wc_restock_refunded_items(WC_Order $order, array<string|int, mixed> $refunded_line_items) : mixed
Order instance.
Refunded items list.
Get tax class by tax id.
wc_get_tax_class_by_tax_id(int $tax_id) : string
Tax ID.
Get payment gateway class by order data.
wc_get_payment_gateway_by_order(int|WC_Order $order) : WC_Payment_Gateway|bool
Order instance.
When refunding an order, create a refund line item if the partial refunds do not match order total.
wc_order_fully_refunded(int $order_id) : mixed
This is manual; no gateway refund will be performed.
Order ID.
Search orders.
wc_order_search(string $term) : array<string|int, mixed>
Term to search.
Update total sales amount for each product within a paid order.
wc_update_total_sales_counts(int $order_id) : mixed
Order ID.
Update used coupon amount for each coupon within an order.
wc_update_coupon_usage_counts(int $order_id) : mixed
Order ID.
Cancel all unpaid orders after held duration to prevent stock lock for those products.
wc_cancel_unpaid_orders() : mixed
Sanitize order id removing unwanted characters.
wc_sanitize_order_id(int $order_id) : mixed
E.g Users can sometimes try to track an order id using # with no success. This function will fix this.
Order ID.
Get an order note.
wc_get_order_note(int|WP_Comment $data) : stdClass|null
Note ID (or WP_Comment instance for internal use only).
Get order notes.
wc_get_order_notes(array<string|int, mixed> $args) : array<string|int, stdClass>
Query arguments { Array of query parameters.
@type string $limit Maximum number of notes to retrieve.
Default empty (no limit).
@type int $order_id Limit results to those affiliated with a given order ID.
Default 0.
@type array $order__in Array of order IDs to include affiliated notes for.
Default empty.
@type array $order__not_in Array of order IDs to exclude affiliated notes for.
Default empty.
@type string $orderby Define how should sort notes.
Accepts 'date_created', 'date_created_gmt' or 'id'.
Default: 'id'.
@type string $order How to order retrieved notes.
Accepts 'ASC' or 'DESC'.
Default: 'DESC'.
@type string $type Define what type of note should retrieve.
Accepts 'customer', 'internal' or empty for both.
Default empty.
}
Create an order note.
wc_create_order_note(int $order_id, string $note[, bool $is_customer_note = false ][, bool $added_by_user = false ]) : int|WP_Error
Order ID.
Note to add.
If is a costumer note.
If note is create by an user.
Delete an order note.
wc_delete_order_note(int $note_id) : bool
Order note.
Add a item to an order (for example a line item).
wc_add_order_item(int $order_id, array<string|int, mixed> $item_array) : int|bool
Order ID.
Items list.
Update an item for an order.
wc_update_order_item(int $item_id, array<string|int, mixed> $args) : bool
Item ID.
Either order_item_type
or order_item_name
.
Delete an item from the order it belongs to based on item id.
wc_delete_order_item(int $item_id) : bool
Item ID.
WooCommerce Order Item Meta API - Update term meta.
wc_update_order_item_meta(int $item_id, string $meta_key, mixed $meta_value[, string $prev_value = '' ]) : bool
Item ID.
Meta key.
Meta value.
Previous value (default: '').
WooCommerce Order Item Meta API - Add term meta.
wc_add_order_item_meta(int $item_id, string $meta_key, mixed $meta_value[, bool $unique = false ]) : int
Item ID.
Meta key.
Meta value.
If meta data should be unique (default: false).
WooCommerce Order Item Meta API - Delete term meta.
wc_delete_order_item_meta(int $item_id, string $meta_key[, mixed $meta_value = '' ][, bool $delete_all = false ]) : bool
Item ID.
Meta key.
Meta value (default: '').
Delete all meta data, defaults to false
.
WooCommerce Order Item Meta API - Get term meta.
wc_get_order_item_meta(int $item_id, string $key[, bool $single = true ]) : mixed
Item ID.
Meta key.
Whether to return a single value. (default: true).
Get order ID by order item ID.
wc_get_order_id_by_order_item_id(int $item_id) : int
Item ID.
Replace a page title with the endpoint title.
wc_page_endpoint_title(string $title) : string
Post title.
Retrieve page ids - used for myaccount, edit_address, shop, cart, checkout, pay, view_order, terms. returns -1 if no page is found.
wc_get_page_id(string $page) : int
Page slug.
Retrieve page permalink.
wc_get_page_permalink(string $page[, string|bool $fallback = null ]) : string
page slug.
Fallback URL if page is not set. Defaults to home URL. @since 3.4.0.
Get endpoint URL.
wc_get_endpoint_url(string $endpoint[, string $value = '' ][, string $permalink = '' ]) : string
Gets the URL for an endpoint, which varies depending on permalink settings.
Endpoint slug.
Query param value.
Permalink.
Hide menu items conditionally.
wc_nav_menu_items(array<string|int, mixed> $items) : array<string|int, mixed>
Navigation items.
Fix active class in nav for shop page.
wc_nav_menu_item_classes(array<string|int, mixed> $menu_items) : array<string|int, mixed>
Menu items.
Fix active class in wp_list_pages for shop page.
wc_list_pages(string $pages) : string
See details in https://github.com/woocommerce/woocommerce/issues/177.
Pages list.
Standard way of retrieving products based on certain parameters.
wc_get_products(array<string|int, mixed> $args) : array<string|int, mixed>|stdClass
This function should be used for product retrieval so that we have a data agnostic way to get a list of products.
Args and usage: https://github.com/woocommerce/woocommerce/wiki/wc_get_products-and-WC_Product_Query
Array of args (above).
Main function for returning products, uses the WC_Product_Factory class.
wc_get_product([mixed $the_product = false ][, array<string|int, mixed> $deprecated = array() ]) : WC_Product|null|false
This function should only be called after 'init' action is finished, as there might be taxonomies that are getting registered during the init action.
Post object or post ID of the product.
Previously used to pass arguments to the factory, e.g. to force a type.
Get a product object.
wc_get_product_object(string $product_type, int $product_id) : WC_Product
Product type. If used an invalid type a WC_Product_Simple instance will be returned.
Product ID.
Returns whether or not SKUS are enabled.
wc_product_sku_enabled() : bool
Returns whether or not product weights are enabled.
wc_product_weight_enabled() : bool
Returns whether or not product dimensions (HxWxD) are enabled.
wc_product_dimensions_enabled() : bool
Clear transient cache for product data.
wc_delete_product_transients(int $post_id) : mixed
(default: 0) The product ID.
Function that returns an array containing the IDs of the products that are on sale.
wc_get_product_ids_on_sale() : array<string|int, mixed>
Function that returns an array containing the IDs of the featured products.
wc_get_featured_product_ids() : array<string|int, mixed>
Filter to allow product_cat in the permalinks for products.
wc_product_post_type_link(string $permalink, WP_Post $post) : string
The existing permalink URL.
WP_Post object.
Get the placeholder image URL either from media, or use the fallback image.
wc_placeholder_img_src([string $size = 'woocommerce_thumbnail' ]) : string
Thumbnail size to use.
Get the placeholder image.
wc_placeholder_img([string $size = 'woocommerce_thumbnail' ][, string|array<string|int, mixed> $attr = '' ]) : string
Uses wp_get_attachment_image if using an attachment ID @since 3.6.0 to handle responsiveness.
Image size.
Optional. Attributes for the image markup. Default empty.
Variation Formatting.
wc_get_formatted_variation(array<string|int, mixed>|WC_Product_Variation $variation[, bool $flat = false ][, bool $include_names = true ][, bool $skip_attributes_in_name = false ]) : string
Gets a formatted version of variation data or item meta.
Variation object.
Should this be a flat list or HTML list? (default: false).
include attribute names/labels in the list.
Do not list attributes already part of the variation name.
Function which handles the start and end of scheduled sales via cron.
wc_scheduled_sales() : mixed
Get attachment image attributes.
wc_get_attachment_image_attributes(array<string|int, mixed> $attr) : array<string|int, mixed>
Image attributes.
Prepare attachment for JavaScript.
wc_prepare_attachment_for_js(array<string|int, mixed> $response) : array<string|int, mixed>
JS version of a attachment post object.
Track product views.
wc_track_product_view() : mixed
Get product types.
wc_get_product_types() : array<string|int, mixed>
Check if product sku is unique.
wc_product_has_unique_sku(int $product_id, string $sku) : bool
Product ID.
Product SKU.
Force a unique SKU.
wc_product_force_unique_sku(int $product_id) : mixed
Product ID.
Recursively appends a suffix until a unique SKU is found.
wc_product_generate_unique_sku(int $product_id, string $sku, int $index) : string
Product ID.
Product SKU.
An optional index that can be added to the product SKU.
Get product ID by SKU.
wc_get_product_id_by_sku(string $sku) : int
Product SKU.
Get attributes/data for an individual variation from the database and maintain it's integrity.
wc_get_product_variation_attributes(int $variation_id) : array<string|int, mixed>
Variation ID.
Get all product cats for a product by ID, including hierarchy
wc_get_product_cat_ids(int $product_id) : array<string|int, mixed>
Product ID.
Gets data about an attachment, such as alt text and captions.
wc_get_product_attachment_props([int|null $attachment_id = null ][, WC_Product|bool $product = false ]) : array<string|int, mixed>
Attachment ID.
WC_Product object.
Get product visibility options.
wc_get_product_visibility_options() : array<string|int, mixed>
Get product tax class options.
wc_get_product_tax_class_options() : array<string|int, mixed>
Get stock status options.
wc_get_product_stock_status_options() : array<string|int, mixed>
Get backorder options.
wc_get_product_backorder_options() : array<string|int, mixed>
Get related products based on product category and tags.
wc_get_related_products(int $product_id[, int $limit = 5 ][, array<string|int, mixed> $exclude_ids = array() ]) : array<string|int, mixed>
Product ID.
Limit of results.
Exclude IDs from the results.
Retrieves product term ids for a taxonomy.
wc_get_product_term_ids(int $product_id, string $taxonomy) : array<string|int, mixed>
Product ID.
Taxonomy slug.
For a given product, and optionally price/qty, work out the price with tax included, based on store settings.
wc_get_price_including_tax(WC_Product $product[, array<string|int, mixed> $args = array() ]) : float|string
WC_Product object.
Optional arguments to pass product quantity and price.
For a given product, and optionally price/qty, work out the price with tax excluded, based on store settings.
wc_get_price_excluding_tax(WC_Product $product[, array<string|int, mixed> $args = array() ]) : float|string
WC_Product object.
Optional arguments to pass product quantity and price.
Returns the price including or excluding tax.
wc_get_price_to_display(WC_Product $product[, array<string|int, mixed> $args = array() ]) : float
By default it's based on the 'woocommerce_tax_display_shop' setting.
Set $arg['display_context']
to 'cart' to base on the 'woocommerce_tax_display_cart' setting instead.
WC_Product object.
Optional arguments to pass product quantity and price.
Returns the product categories in a list.
wc_get_product_category_list(int $product_id[, string $sep = ', ' ][, string $before = '' ][, string $after = '' ]) : string
Product ID.
(default: ', ').
(default: '').
(default: '').
Returns the product tags in a list.
wc_get_product_tag_list(int $product_id[, string $sep = ', ' ][, string $before = '' ][, string $after = '' ]) : string
Product ID.
(default: ', ').
(default: '').
(default: '').
Callback for array filter to get visible only.
wc_products_array_filter_visible(WC_Product $product) : bool
WC_Product object.
Callback for array filter to get visible grouped products only.
wc_products_array_filter_visible_grouped(WC_Product $product) : bool
WC_Product object.
Callback for array filter to get products the user can edit only.
wc_products_array_filter_editable(WC_Product $product) : bool
WC_Product object.
Callback for array filter to get products the user can view only.
wc_products_array_filter_readable(WC_Product $product) : bool
WC_Product object.
Sort an array of products by a value.
wc_products_array_orderby(array<string|int, mixed> $products[, string $orderby = 'date' ][, string $order = 'desc' ]) : array<string|int, mixed>
List of products to be ordered.
Optional order criteria.
Ascending or descending order.
Sort by title.
wc_products_array_orderby_title(WC_Product $a, WC_Product $b) : int
First WC_Product object.
Second WC_Product object.
Sort by id.
wc_products_array_orderby_id(WC_Product $a, WC_Product $b) : int
First WC_Product object.
Second WC_Product object.
Sort by date.
wc_products_array_orderby_date(WC_Product $a, WC_Product $b) : int
First WC_Product object.
Second WC_Product object.
Sort by modified.
wc_products_array_orderby_modified(WC_Product $a, WC_Product $b) : int
First WC_Product object.
Second WC_Product object.
Sort by menu order.
wc_products_array_orderby_menu_order(WC_Product $a, WC_Product $b) : int
First WC_Product object.
Second WC_Product object.
Sort by price low to high.
wc_products_array_orderby_price(WC_Product $a, WC_Product $b) : int
First WC_Product object.
Second WC_Product object.
Queue a product for syncing at the end of the request.
wc_deferred_product_sync(int $product_id) : mixed
Product ID.
See if the lookup table is being generated already.
wc_update_product_lookup_tables_is_running() : bool
Populate lookup table data for products.
wc_update_product_lookup_tables() : mixed
Populate lookup table column data.
wc_update_product_lookup_tables_column(string $column) : mixed
Column name to set.
Populate rating count lookup table data for products.
wc_update_product_lookup_tables_rating_count(array<string|int, mixed> $rows) : mixed
Rows of rating counts to update in lookup table.
Populate a batch of rating count lookup table data for products.
wc_update_product_lookup_tables_rating_count_batch(array<string|int, mixed> $offset, array<string|int, mixed> $limit) : mixed
Offset to query.
Limit to query.
Attach product featured image. Use image filename to match a product sku when product is not provided.
wc_product_attach_featured_image(int $attachment_id[, WC_Product $product = null ][, bool $save_product = true ]) : void
Media attachment ID.
Optional product object.
If true, the changes in the product will be saved before the method returns.
Parses and formats a date for ISO8601/RFC3339.
wc_rest_prepare_date_response(string|null|WC_DateTime $date[, bool $utc = true ]) : string|null
Required WP 4.4 or later. See https://developer.wordpress.org/reference/functions/mysql_to_rfc3339/
Date.
Send false to get local/offset time.
Returns image mime types users are allowed to upload via the API.
wc_rest_allowed_image_mime_types() : array<string|int, mixed>
Upload image from URL.
wc_rest_upload_image_from_url(string $image_url) : array<string|int, mixed>|WP_Error
Image URL.
Set uploaded image as attachment.
wc_rest_set_uploaded_image_as_attachment(array<string|int, mixed> $upload, int $id) : int
Upload information from wp_upload_bits.
Post ID. Default to 0.
Validate reports request arguments.
wc_rest_validate_reports_request_arg(mixed $value, WP_REST_Request $request, string $param) : WP_Error|bool
Value to validate.
Request instance.
Param to validate.
Encodes a value according to RFC 3986.
wc_rest_urlencode_rfc3986(string|array<string|int, mixed> $value) : string|array<string|int, mixed>
Supports multidimensional arrays.
The value to encode.
Check permissions of posts on REST API.
wc_rest_check_post_permissions(string $post_type[, string $context = 'read' ], int $object_id) : bool
Post type.
Request context.
Post ID.
Check permissions of users on REST API.
wc_rest_check_user_permissions([string $context = 'read' ], int $object_id) : bool
Request context.
Post ID.
Check permissions of product terms on REST API.
wc_rest_check_product_term_permissions(string $taxonomy[, string $context = 'read' ], int $object_id) : bool
Taxonomy.
Request context.
Post ID.
Check manager permissions on REST API.
wc_rest_check_manager_permissions(string $object[, string $context = 'read' ]) : bool
Object.
Request context.
Check product reviews permissions on REST API.
wc_rest_check_product_reviews_permissions([string $context = 'read' ], string $object_id) : bool
Request context.
Object ID.
Returns true if the current REST request is from the product editor.
wc_rest_is_from_product_editor() : bool
Update a product's stock amount.
wc_update_product_stock(int|WC_Product $product[, int|null $stock_quantity = null ][, string $operation = 'set' ][, bool $updating = false ]) : bool|int|null
Uses queries rather than update_post_meta so we can do this in one query (to avoid stock issues).
Product ID or product instance.
Stock quantity.
Type of operation, allows 'set', 'increase' and 'decrease'.
If true, the product object won't be saved here as it will be updated later.
Update a product's stock status.
wc_update_product_stock_status(int $product_id, string $status) : mixed
Product ID.
Status.
When a payment is complete, we can reduce stock levels for items within an order.
wc_maybe_reduce_stock_levels(int $order_id) : mixed
Order ID.
When a payment is cancelled, restore stock.
wc_maybe_increase_stock_levels(int $order_id) : mixed
Order ID.
Reduce stock levels for items within an order, if stock has not already been reduced for the items.
wc_reduce_stock_levels(int|WC_Order $order_id) : mixed
Order ID or order instance.
After stock change events, triggers emails and adds order notes.
wc_trigger_stock_change_notifications(WC_Order $order, array<string|int, mixed> $changes) : mixed
order object.
Array of changes.
Increase stock levels for items within an order.
wc_increase_stock_levels(int|WC_Order $order_id) : mixed
Order ID or order instance.
See how much stock is being held in pending orders.
wc_get_held_stock_quantity(WC_Product $product, int $exclude_order_id) : int
Product to check.
Order ID to exclude.
Hold stock for an order.
wc_reserve_stock_for_order(WC_Order|int $order) : mixed
Order ID or instance.
Release held stock for an order.
wc_release_stock_for_order(WC_Order|int $order) : mixed
Order ID or instance.
Return low stock amount to determine if notification needs to be sent
wc_get_low_stock_amount(WC_Product $product) : int
Since 5.2.0, this function no longer redirects from variation to its parent product. Low stock amount can now be attached to the variation itself and if it isn't, only then we check the parent product, and if it's not there, then we take the default from the store-wide setting.
Product to get data from.
Handle redirects before content is output - hooked into template_redirect so is_page works.
wc_template_redirect() : mixed
When loading sensitive checkout or account pages, send a HTTP header to limit rendering of pages to same origin iframes for security reasons.
wc_send_frame_options_header() : mixed
Can be disabled with: remove_action( 'template_redirect', 'wc_send_frame_options_header' );
No index our endpoints.
wc_prevent_endpoint_indexing() : mixed
Prevent indexing pages like order-received.
Remove adjacent_posts_rel_link_wp_head - pointless for products.
wc_prevent_adjacent_posts_rel_link_wp_head() : mixed
Show the gallery if JS is disabled.
wc_gallery_noscript() : mixed
When the_post is called, put product data into a global.
wc_setup_product_data(mixed $post) : WC_Product
Post Object.
Sets up the woocommerce_loop global from the passed args or from the main query.
wc_setup_loop([array<string|int, mixed> $args = array() ]) : mixed
Args to pass into the global.
Resets the woocommerce_loop global.
wc_reset_loop() : mixed
Gets a property from the woocommerce_loop global.
wc_get_loop_prop(string $prop[, string $default = '' ]) : mixed
Prop to get.
Default if the prop does not exist.
Sets a property in the woocommerce_loop global.
wc_set_loop_prop(string $prop[, string $value = '' ]) : mixed
Prop to set.
Value to set.
Set the current visbility for a product in the woocommerce_loop global.
wc_set_loop_product_visibility(int $product_id, bool $value) : mixed
Product it to cache visbiility for.
The poduct visibility value to cache.
Gets the cached current visibility for a product from the woocommerce_loop global.
wc_get_loop_product_visibility(int $product_id) : bool|null
Product id to get the cached visibility for.
Should the WooCommerce loop be displayed?
woocommerce_product_loop() : bool
This will return true if we have posts (products) or if we have subcats to display.
Output generator tag to aid debugging.
wc_generator_tag(string $gen, string $type) : string
Generator.
Type.
Add body classes for WC pages.
wc_body_class(array<string|int, mixed> $classes) : array<string|int, mixed>
Body Classes.
NO JS handling.
wc_no_js() : mixed
Display the classes for the product cat div.
wc_product_cat_class([string|array<string|int, mixed> $class = '' ][, object $category = null ]) : mixed
One or more classes to add to the class list.
object Optional.
Get the default columns setting - this is how many products will be shown per row in loops.
wc_get_default_products_per_row() : int
Get the default rows setting - this is how many product rows will be shown in loops.
wc_get_default_product_rows_per_page() : int
Reset the product grid settings when a new theme is activated.
wc_reset_product_grid_settings() : mixed
Get classname for woocommerce loops.
wc_get_loop_class() : string
Get the classes for the product cat div.
wc_get_product_cat_class([string|array<string|int, mixed> $class = '' ][, object $category = null ]) : array<string|int, mixed>
One or more classes to add to the class list.
object Optional.
Adds extra post classes for products via the WordPress post_class hook, if used.
wc_product_post_class(array<string|int, mixed> $classes[, string|array<string|int, mixed> $class = '' ], int $post_id) : array<string|int, mixed>
Note: For performance reasons we instead recommend using wc_product_class/wc_get_product_class instead.
Current classes.
Additional class.
Post ID.
Get product taxonomy HTML classes.
wc_get_product_taxonomy_class(array<string|int, mixed> $term_ids, string $taxonomy) : array<string|int, mixed>
Array of terms IDs or objects.
Taxonomy.
Retrieves the classes for the post div as an array.
wc_get_product_class([string|array<string|int, mixed> $class = '' ][, int|WP_Post|WC_Product $product = null ]) : array<string|int, mixed>
This method was modified from WordPress's get_post_class() to allow the removal of taxonomies (for performance reasons). Previously wc_product_post_class was hooked into post_class. @since 3.6.0
One or more classes to add to the class list.
Product ID or product object.
Display the classes for the product div.
wc_product_class([string|array<string|int, mixed> $class = '' ][, int|WP_Post|WC_Product $product_id = null ]) : mixed
One or more classes to add to the class list.
Product ID or product object.
Outputs hidden form inputs for each query string variable.
wc_query_string_form_fields([string|array<string|int, mixed> $values = null ][, array<string|int, mixed> $exclude = array() ][, string $current_key = '' ][, bool $return = false ]) : string
Name value pairs, or a URL to parse.
Keys to exclude.
Current key we are outputting.
Whether to return.
Get the terms and conditions page ID.
wc_terms_and_conditions_page_id() : int
Get the privacy policy page ID.
wc_privacy_policy_page_id() : int
See if the checkbox is enabled or not based on the existence of the terms page and checkbox text.
wc_terms_and_conditions_checkbox_enabled() : bool
Get the terms and conditions checkbox text, if set.
wc_get_terms_and_conditions_checkbox_text() : string
Get the privacy policy text, if set.
wc_get_privacy_policy_text([string $type = '' ]) : string
Type of policy to load. Valid values include registration and checkout.
Output t&c checkbox text.
wc_terms_and_conditions_checkbox_text() : mixed
Output t&c page's content (if set). The page can be set from checkout settings.
wc_terms_and_conditions_page_content() : mixed
Render privacy policy text on the checkout.
wc_checkout_privacy_policy_text() : mixed
Render privacy policy text on the register forms.
wc_registration_privacy_policy_text() : mixed
Output privacy policy text. This is custom text which can be added via the customizer/privacy settings section.
wc_privacy_policy_text([string $type = 'checkout' ]) : mixed
Loads the relevant policy for the current page unless a specific policy text is required.
Type of policy to load. Valid values include registration and checkout.
Replaces placeholders with links to WooCommerce policy pages.
wc_replace_policy_page_link_placeholders(string $text) : string
Text to find/replace within.
Output WooCommerce content.
woocommerce_content() : mixed
This function is only used in the optional 'woocommerce.php' template. which people can add to their themes to add basic woocommerce support. without hooks or modifying core templates.
Output the start of the page wrapper.
woocommerce_output_content_wrapper() : mixed
Output the end of the page wrapper.
woocommerce_output_content_wrapper_end() : mixed
Get the shop sidebar template.
woocommerce_get_sidebar() : mixed
Adds a demo store banner to the site if enabled.
woocommerce_demo_store() : mixed
Page Title function.
woocommerce_page_title([bool $echo = true ]) : string
Should echo title.
Output the start of a product loop. By default this is a UL.
woocommerce_product_loop_start([bool $echo = true ]) : string
Should echo?.
Output the end of a product loop. By default this is a UL.
woocommerce_product_loop_end([bool $echo = true ]) : string
Should echo?.
Show the product title in the product loop. By default this is an H2.
woocommerce_template_loop_product_title() : mixed
Show the subcategory title in the product loop.
woocommerce_template_loop_category_title(object $category) : mixed
Category object.
Insert the opening anchor tag for products in the loop.
woocommerce_template_loop_product_link_open() : mixed
Insert the closing anchor tag for products in the loop.
woocommerce_template_loop_product_link_close() : mixed
Insert the opening anchor tag for categories in the loop.
woocommerce_template_loop_category_link_open(int|object|string $category) : mixed
Category ID, Object or String.
Insert the closing anchor tag for categories in the loop.
woocommerce_template_loop_category_link_close() : mixed
Output the products header on taxonomy archives.
woocommerce_product_taxonomy_archive_header() : mixed
Show an archive description on taxonomy archives.
woocommerce_taxonomy_archive_description() : mixed
Show a shop page description on product archives.
woocommerce_product_archive_description() : mixed
Get the add to cart template for the loop.
woocommerce_template_loop_add_to_cart([array<string|int, mixed> $args = array() ]) : mixed
Arguments.
Get the product thumbnail for the loop.
woocommerce_template_loop_product_thumbnail() : mixed
Get the product price for the loop.
woocommerce_template_loop_price() : mixed
Display the average rating in the loop.
woocommerce_template_loop_rating() : mixed
Get the sale flash for the loop.
woocommerce_show_product_loop_sale_flash() : mixed
Get the product thumbnail, or the placeholder if not set.
woocommerce_get_product_thumbnail([string $size = 'woocommerce_thumbnail' ][, array<string|int, mixed> $attr = array() ][, bool $placeholder = true ]) : string
(default: 'woocommerce_thumbnail').
Image attributes.
True to return $placeholder if no image is found, or false to return an empty string.
Output the result count text (Showing x - x of x results).
woocommerce_result_count() : mixed
Output the product sorting options.
woocommerce_catalog_ordering() : mixed
Output the pagination.
woocommerce_pagination() : mixed
Output the product image before the single product summary.
woocommerce_show_product_images() : mixed
Output the product thumbnails.
woocommerce_show_product_thumbnails() : mixed
Get HTML for a gallery image.
wc_get_gallery_image_html(int $attachment_id[, bool $main_image = false ]) : string
Hooks: woocommerce_gallery_thumbnail_size, woocommerce_gallery_image_size and woocommerce_gallery_full_size accept name based image sizes, or an array of width/height values.
Attachment ID.
Is this the main image or a thumbnail?.
Output the product tabs.
woocommerce_output_product_data_tabs() : mixed
Output the product title.
woocommerce_template_single_title() : mixed
Output the product rating.
woocommerce_template_single_rating() : mixed
Output the product price.
woocommerce_template_single_price() : mixed
Output the product short description (excerpt).
woocommerce_template_single_excerpt() : mixed
Output the product meta.
woocommerce_template_single_meta() : mixed
Output the product sharing.
woocommerce_template_single_sharing() : mixed
Output the product sale flash.
woocommerce_show_product_sale_flash() : mixed
Trigger the single product add to cart action.
woocommerce_template_single_add_to_cart() : mixed
Output the simple product add to cart area.
woocommerce_simple_add_to_cart() : mixed
Output the grouped product add to cart area.
woocommerce_grouped_add_to_cart() : mixed
Output the variable product add to cart area.
woocommerce_variable_add_to_cart() : mixed
Output the external product add to cart area.
woocommerce_external_add_to_cart() : mixed
Output the quantity input for add to cart forms.
woocommerce_quantity_input([array<string|int, mixed> $args = array() ][, WC_Product|null $product = null ][, bool $echo = true ]) : string
Args for the input.
Product.
Whether to return or echo|string.
Output the description tab content.
woocommerce_product_description_tab() : mixed
Output the attributes tab content.
woocommerce_product_additional_information_tab() : mixed
Add default product tabs to product pages.
woocommerce_default_product_tabs([array<string|int, mixed> $tabs = array() ]) : array<string|int, mixed>
Array of tabs.
Sort tabs by priority.
woocommerce_sort_product_tabs([array<string|int, mixed> $tabs = array() ]) : array<string|int, mixed>
Array of tabs.
Output the Review comments template.
woocommerce_comments(WP_Comment $comment, array<string|int, mixed> $args, int $depth) : mixed
Comment object.
Arguments.
Depth.
Display the review authors gravatar
woocommerce_review_display_gravatar(array<string|int, mixed> $comment) : void
WP_Comment.
Display the reviewers star rating
woocommerce_review_display_rating() : void
Display the review authors meta (name, verified owner, review date)
woocommerce_review_display_meta() : void
Display the review content.
woocommerce_review_display_comment_text() : mixed
Output the related products.
woocommerce_output_related_products() : mixed
Output the related products.
woocommerce_related_products([array<string|int, mixed> $args = array() ]) : mixed
Provided arguments.
Output product up sells.
woocommerce_upsell_display([int $limit = '-1' ][, int $columns = 4 ][, string $orderby = 'rand' ][, string $order = 'desc' ]) : mixed
(default: -1).
(default: 4).
Supported values - rand, title, ID, date, modified, menu_order, price.
Sort direction.
Output the cart shipping calculator.
woocommerce_shipping_calculator([string $button_text = '' ]) : mixed
Text for the shipping calculation toggle.
Output the cart totals.
woocommerce_cart_totals() : mixed
Output the cart cross-sells.
woocommerce_cross_sell_display([int $limit = 2 ][, int $columns = 2 ][, string $orderby = 'rand' ][, string $order = 'desc' ]) : mixed
(default: 2).
(default: 2).
(default: 'rand').
(default: 'desc').
Output the proceed to checkout button.
woocommerce_button_proceed_to_checkout() : mixed
Output the view cart button.
woocommerce_widget_shopping_cart_button_view_cart() : mixed
Output the proceed to checkout button.
woocommerce_widget_shopping_cart_proceed_to_checkout() : mixed
Output to view cart subtotal.
woocommerce_widget_shopping_cart_subtotal() : mixed
Output the Mini-cart - used by cart widget.
woocommerce_mini_cart([array<string|int, mixed> $args = array() ]) : mixed
Arguments.
Output the WooCommerce Login Form.
woocommerce_login_form([array<string|int, mixed> $args = array() ]) : mixed
Arguments.
Output the WooCommerce Checkout Login Form.
woocommerce_checkout_login_form() : mixed
Output the WooCommerce Breadcrumb.
woocommerce_breadcrumb([array<string|int, mixed> $args = array() ]) : mixed
Arguments.
Output the Order review table for the checkout.
woocommerce_order_review([bool $deprecated = false ]) : mixed
Deprecated param.
Output the Payment Methods on the checkout.
woocommerce_checkout_payment() : mixed
Output the Coupon form for the checkout.
woocommerce_checkout_coupon_form() : mixed
Check if we will be showing products or not (and not sub-categories only).
woocommerce_products_will_display() : bool
See what is going to display in the loop.
woocommerce_get_loop_display_mode() : string
Maybe display categories before, or instead of, a product loop.
woocommerce_maybe_show_product_subcategories([string $loop_html = '' ]) : string
HTML.
This is a legacy function which used to check if we needed to display subcats and then output them. It was called by templates.
woocommerce_product_subcategories([array<string|int, mixed> $args = array() ]) : null|bool
From 3.3 onwards this is all handled via hooks and the woocommerce_maybe_show_product_subcategories function.
Since some templates have not updated compatibility, to avoid showing incorrect categories this function has been deprecated and will return nothing. Replace usage with woocommerce_output_product_categories to render the category list manually.
This is a legacy function which also checks if things should display. Themes no longer need to call these functions. It's all done via hooks.
Arguments.
Display product sub categories as thumbnails.
woocommerce_output_product_categories([array<string|int, mixed> $args = array() ]) : bool
This is a replacement for woocommerce_product_subcategories which also does some logic based on the loop. This function however just outputs when called.
Arguments.
Get (and cache) product subcategories.
woocommerce_get_product_subcategories(int $parent_id) : array<string|int, mixed>
Get subcategories of this ID.
Show subcategory thumbnails.
woocommerce_subcategory_thumbnail(mixed $category) : mixed
Category.
Displays order details in a table.
woocommerce_order_details_table(mixed $order_id) : mixed
Order ID.
Displays order downloads in a table.
woocommerce_order_downloads_table(array<string|int, mixed> $downloads) : mixed
Downloads.
Display an 'order again' button on the view order page.
woocommerce_order_again_button(object $order) : mixed
Order.
Outputs a checkout/address form field.
woocommerce_form_field(string $key, mixed $args[, string $value = null ]) : string
Key.
Arguments.
(default: null).
Display product search form.
get_product_search_form([bool $echo = true ]) : string
Will first attempt to locate the product-searchform.php file in either the child or. the parent, then load it. If it doesn't exist, then the default search form. will be displayed.
The default searchform uses html5.
(default: true).
Output the Auth header.
woocommerce_output_auth_header() : mixed
Output the Auth footer.
woocommerce_output_auth_footer() : mixed
Output placeholders for the single variation.
woocommerce_single_variation() : mixed
Output the add to cart button for variations.
woocommerce_single_variation_add_to_cart_button() : mixed
Output a list of variation attributes for use in the cart forms.
wc_dropdown_variation_attribute_options([array<string|int, mixed> $args = array() ]) : mixed
Arguments.
My Account content output.
woocommerce_account_content() : mixed
My Account navigation template.
woocommerce_account_navigation() : mixed
My Account > Orders template.
woocommerce_account_orders(int $current_page) : mixed
Current page number.
My Account > View order template.
woocommerce_account_view_order(int $order_id) : mixed
Order ID.
My Account > Downloads template.
woocommerce_account_downloads() : mixed
My Account > Edit address template.
woocommerce_account_edit_address(string $type) : mixed
Type of address; 'billing' or 'shipping'.
My Account > Downloads template.
woocommerce_account_payment_methods() : mixed
My Account > Add payment method template.
woocommerce_account_add_payment_method() : mixed
My Account > Edit account template.
woocommerce_account_edit_account() : mixed
Handles the loop when no products were found/no product exist.
wc_no_products_found() : mixed
Get HTML for the order items to be shown in emails.
wc_get_email_order_items(WC_Order $order[, array<string|int, mixed> $args = array() ]) : string
Order object.
Arguments.
Display item meta data.
wc_display_item_meta(WC_Order_Item $item[, array<string|int, mixed> $args = array() ]) : string|void
Order Item.
Arguments.
Display item download links.
wc_display_item_downloads(WC_Order_Item $item[, array<string|int, mixed> $args = array() ]) : string|void
Order Item.
Arguments.
Get the shop sidebar template.
woocommerce_photoswipe() : mixed
Outputs a list of product attributes for a product.
wc_display_product_attributes(WC_Product $product) : mixed
Product Object.
Get HTML to show product stock.
wc_get_stock_html(WC_Product $product) : string
Product Object.
Get HTML for ratings.
wc_get_rating_html(float $rating, int $count) : string
Rating being shown.
Total number of ratings.
Get HTML for star rating.
wc_get_star_rating_html(float $rating, int $count) : string
Rating being shown.
Total number of ratings.
Returns a 'from' prefix if you want to show where prices start at.
wc_get_price_html_from_text() : string
Get logout endpoint.
wc_logout_url([string $redirect = '' ]) : string
Redirect URL.
Show notice if cart is empty.
wc_empty_cart_message() : mixed
Disable search engines indexing core, dynamic, cart/checkout pages.
wc_page_noindex() : mixed
Disable search engines indexing core, dynamic, cart/checkout pages.
wc_page_no_robots(array<string|int, mixed> $robots) : array<string|int, mixed>
Uses "wp_robots" filter introduced in WP 5.7.
Associative array of robots directives.
Get a slug identifying the current theme.
wc_get_theme_slug_for_templates() : string
Gets and formats a list of cart item data + variations for display on the frontend.
wc_get_formatted_cart_item_data(array<string|int, mixed> $cart_item[, bool $flat = false ]) : string
Cart item object.
Should the data be returned flat or in a list.
Gets the url to remove an item from the cart.
wc_get_cart_remove_url(string $cart_item_key) : string
contains the id of the cart item.
Gets the url to re-add an item into the cart.
wc_get_cart_undo_url(string $cart_item_key) : string
Cart item key to undo.
Outputs all queued notices on WC pages.
woocommerce_output_all_notices() : mixed
Products RSS Feed.
wc_products_rss_feed() : mixed
Reset the loop's index and columns when we're done outputting a product loop.
woocommerce_reset_loop() : mixed
Output the reviews tab content.
woocommerce_product_reviews_tab() : mixed
Display pay buttons HTML.
wc_get_pay_buttons() : mixed
Update the product archive title to the title of the shop page. Fallback to 'Shop' if the shop page doesn't exist.
wc_update_product_archive_title(string $post_type_name, string $post_type) : string
Post type 'name' label.
Post type.
Change get terms defaults for attributes to order by the sorting setting, or default to menu_order for sortable taxonomies.
wc_change_get_terms_defaults(array<string|int, mixed> $defaults, array<string|int, mixed> $taxonomies) : array<string|int, mixed>
An array of default get_terms() arguments.
An array of taxonomies.
Adds support to get_terms for menu_order argument.
wc_change_pre_get_terms(WP_Term_Query $terms_query) : mixed
Instance of WP_Term_Query.
Adjust term query to handle custom sorting parameters.
wc_terms_clauses(array<string|int, mixed> $clauses, array<string|int, mixed> $taxonomies, array<string|int, mixed> $args) : array<string|int, mixed>
Clauses.
Taxonomies.
Arguments.
Helper to get cached object terms and filter by field using wp_list_pluck().
wc_get_object_terms(int $object_id, string $taxonomy[, string $field = null ][, string $index_key = null ]) : array<string|int, mixed>
Works as a cached alternative for wp_get_post_terms() and wp_get_object_terms().
Object ID.
Taxonomy slug.
Field name.
Index key name.
Cached version of wp_get_post_terms().
_wc_get_cached_product_terms(int $product_id, string $taxonomy[, array<string|int, mixed> $args = array() ]) : array<string|int, mixed>
This is a private function (internal use ONLY).
Product ID.
Taxonomy slug.
Query arguments.
Wrapper used to get terms for a product.
wc_get_product_terms(int $product_id, string $taxonomy[, array<string|int, mixed> $args = array() ]) : array<string|int, mixed>
Product ID.
Taxonomy slug.
Query arguments.
Sort by name (numeric).
_wc_get_product_terms_name_num_usort_callback(WP_Post $a, WP_Post $b) : int
First item to compare.
Second item to compare.
Sort by parent.
_wc_get_product_terms_parent_usort_callback(WP_Post $a, WP_Post $b) : int
First item to compare.
Second item to compare.
WooCommerce Dropdown categories.
wc_product_dropdown_categories([array<string|int, mixed> $args = array() ]) : mixed
Args to control display of dropdown.
Custom walker for Product Categories.
wc_walk_category_dropdown_tree(mixed ...$args) : mixed
Previously used by wc_product_dropdown_categories, but wp_dropdown_categories has been fixed in core.
Variable number of parameters to be passed to the walker.
Migrate data from WC term meta to WP term meta.
wc_taxonomy_metadata_migrate_data(string $wp_db_version, string $wp_current_db_version) : mixed
When the database is updated to support term meta, migrate WC term meta data across. We do this when the new version is >= 34370, and the old version is < 34370 (34370 is when term meta table was added).
The new $wp_db_version.
The old (current) $wp_db_version.
Move a term before the a given element of its hierarchy level.
wc_reorder_terms(int $the_term, int $next_id, string $taxonomy, int $index[, mixed $terms = null ]) : int
Term ID.
The id of the next sibling element in save hierarchy level.
Taxonomy.
Term index (default: 0).
List of terms. (default: null).
Set the sort order of a term.
wc_set_term_order(int $term_id, int $index, string $taxonomy[, bool $recursive = false ]) : int
Term ID.
Index.
Taxonomy.
Recursive (default: false).
Function for recounting product terms, ignoring hidden products.
_wc_term_recount(array<string|int, mixed> $terms, object $taxonomy[, bool $callback = true ][, bool $terms_are_term_taxonomy_ids = true ]) : mixed
List of terms.
Taxonomy.
Callback.
If terms are from term_taxonomy_id column.
Recount terms after the stock amount changes.
wc_recount_after_stock_change(int $product_id) : mixed
Product ID.
Overrides the original term count for product categories and tags with the product count.
wc_change_term_counts(array<string|int, mixed> $terms, string|array<string|int, mixed> $taxonomies) : array<string|int, mixed>
that takes catalog visibility into account.
List of terms.
Single taxonomy or list of taxonomies.
Return products in a given term, and cache value.
wc_get_term_product_ids(int $term_id, string $taxonomy) : array<string|int, mixed>
To keep in sync, product_count will be cleared on "set_object_terms".
Term ID.
Taxonomy.
When a post is updated and terms recounted (called by _update_post_term_count), clear the ids.
wc_clear_term_product_ids(int $object_id, array<string|int, mixed> $terms, array<string|int, mixed> $tt_ids, string $taxonomy, bool $append, array<string|int, mixed> $old_tt_ids) : mixed
Object ID.
An array of object terms.
An array of term taxonomy IDs.
Taxonomy slug.
Whether to append new terms to the old terms.
Old array of term taxonomy IDs.
Get full list of product visibility term ids.
wc_get_product_visibility_term_ids() : array<string|int, int>
Recounts all terms.
wc_recount_all_terms() : void
Recounts terms by product.
_wc_recount_terms_by_product([int $product_id = '' ]) : void
The ID of the product.
Update file paths for 2.0
wc_update_200_file_paths() : void
Update permalinks for 2.0
wc_update_200_permalinks() : void
Update sub-category display options for 2.0
wc_update_200_subcat_display() : void
Update tax rates for 2.0
wc_update_200_taxrates() : void
Update order item line items for 2.0
wc_update_200_line_items() : void
Update image settings for 2.0
wc_update_200_images() : void
Update DB version for 2.0
wc_update_200_db_version() : void
Update Brazilian States for 2.0.9
wc_update_209_brazillian_state() : void
Update DB version for 2.0.9
wc_update_209_db_version() : void
Remove pages for 2.1
wc_update_210_remove_pages() : void
Update file paths to support multiple files for 2.1
wc_update_210_file_paths() : void
Update DB version for 2.1
wc_update_210_db_version() : void
Update shipping options for 2.2
wc_update_220_shipping() : void
Update order statuses for 2.2
wc_update_220_order_status() : void
Update variations for 2.2
wc_update_220_variations() : void
Update attributes for 2.2
wc_update_220_attributes() : void
Update DB version for 2.2
wc_update_220_db_version() : void
Update options for 2.3
wc_update_230_options() : void
Update DB version for 2.3
wc_update_230_db_version() : void
Update calc discount options for 2.4
wc_update_240_options() : void
Update shipping methods for 2.4
wc_update_240_shipping_methods() : void
Update API keys for 2.4
wc_update_240_api_keys() : void
Update webhooks for 2.4
wc_update_240_webhooks() : void
Update refunds for 2.4
wc_update_240_refunds() : void
Update DB version for 2.4
wc_update_240_db_version() : void
Update variations for 2.4.1
wc_update_241_variations() : void
Update DB version for 2.4.1
wc_update_241_db_version() : void
Update currency settings for 2.5
wc_update_250_currency() : void
Update DB version for 2.5
wc_update_250_db_version() : void
Update ship to countries options for 2.6
wc_update_260_options() : void
Update term meta for 2.6
wc_update_260_termmeta() : void
Update zones for 2.6
wc_update_260_zones() : void
Update zone methods for 2.6
wc_update_260_zone_methods() : void
Update refunds for 2.6
wc_update_260_refunds() : void
Update DB version for 2.6
wc_update_260_db_version() : void
Update webhooks for 3.0
wc_update_300_webhooks() : void
Add an index to the field comment_type to improve the response time of the query used by WC_Comments::wp_count_comments() to get the number of comments by type.
wc_update_300_comment_type_index() : mixed
Update grouped products for 3.0
wc_update_300_grouped_products() : void
Update shipping tax classes for 3.0
wc_update_300_settings() : void
Convert meta values into term for product visibility.
wc_update_300_product_visibility() : mixed
Update DB Version.
wc_update_300_db_version() : mixed
Add an index to the downloadable product permissions table to improve performance of update_user_by_order_id.
wc_update_310_downloadable_products() : mixed
Find old order notes and ensure they have the correct type for exclusion.
wc_update_310_old_comments() : mixed
Update DB Version.
wc_update_310_db_version() : mixed
Update shop_manager capabilities.
wc_update_312_shop_manager_capabilities() : mixed
Update DB Version.
wc_update_312_db_version() : mixed
Update state codes for Mexico.
wc_update_320_mexican_states() : mixed
Update DB Version.
wc_update_320_db_version() : mixed
Update image settings to use new aspect ratios and widths.
wc_update_330_image_options() : mixed
Migrate webhooks from post type to CRUD.
wc_update_330_webhooks() : mixed
Assign default cat to all products with no cats.
wc_update_330_set_default_product_cat() : mixed
Update product stock status to use the new onbackorder status.
wc_update_330_product_stock_status() : mixed
Clear addons page transients
wc_update_330_clear_transients() : mixed
Set PayPal's sandbox credentials.
wc_update_330_set_paypal_sandbox_credentials() : mixed
Update DB Version.
wc_update_330_db_version() : mixed
Update state codes for Ireland and BD.
wc_update_340_states() : mixed
Update next state in the queue.
wc_update_340_state() : bool
Set last active prop for users.
wc_update_340_last_active() : mixed
Update DB Version.
wc_update_340_db_version() : mixed
Remove duplicate foreign keys
wc_update_343_cleanup_foreign_keys() : void
Update DB version.
wc_update_343_db_version() : void
Recreate user roles so existing users will get the new capabilities.
wc_update_344_recreate_roles() : void
Update DB version.
wc_update_344_db_version() : void
Set the comment type to 'review' for product reviews that don't have a comment type.
wc_update_350_reviews_comment_type() : mixed
Update DB Version.
wc_update_350_db_version() : mixed
Drop the fk_wc_download_log_permission_id FK as we use a new one with the table and blog prefix for MS compatibility.
wc_update_352_drop_download_log_fk() : void
Remove edit_user capabilities from shop managers and use "translated" capabilities instead.
wc_update_354_modify_shop_manager_caps() : mixed
See wc_shop_manager_has_capability function.
Update DB Version.
wc_update_354_db_version() : mixed
Update product lookup tables in bulk.
wc_update_360_product_lookup_tables() : mixed
Renames ordering meta to be consistent across taxonomies.
wc_update_360_term_meta() : mixed
Add new user_order_remaining_expires to speed up user download permission fetching.
wc_update_360_downloadable_product_permissions_index() : void
Update DB Version.
wc_update_360_db_version() : mixed
Put tax classes into a DB table.
wc_update_370_tax_rate_classes() : void
Update currency settings for 3.7.0
wc_update_370_mro_std_currency() : void
Update DB Version.
wc_update_370_db_version() : mixed
We've moved the MaxMind database to a new location, as per the TOS' requirement that the database not be publicly accessible.
wc_update_390_move_maxmind_database() : mixed
So that we can best meet MaxMind's TOS, the geolocation database update cron should run once per 15 days.
wc_update_390_change_geolocation_database_update_cron() : mixed
Update DB version.
wc_update_390_db_version() : mixed
Increase column size
wc_update_400_increase_size_of_column() : mixed
Reset ActionScheduler migration status. Needs AS >= 3.0 shipped with WC >= 4.0.
wc_update_400_reset_action_scheduler_migration_status() : mixed
Update DB version.
wc_update_400_db_version() : mixed
Register attributes as terms for variable products, in increments of 100 products.
wc_update_440_insert_attribute_terms_for_variable_products() : bool
This migration was added to support a new mechanism to improve the filtering of variable products by attribute (https://github.com/woocommerce/woocommerce/pull/26260), however that mechanism was later reverted (https://github.com/woocommerce/woocommerce/pull/27625) due to numerous issues found. Thus the migration is no longer needed.
Update DB version.
wc_update_440_db_version() : mixed
Update DB version to 4.5.0.
wc_update_450_db_version() : mixed
Sanitize all coupons code.
wc_update_450_sanitize_coupons_code() : bool
Fixes product review count that might have been incorrect.
wc_update_500_fix_product_review_count() : mixed
See @link https://github.com/woocommerce/woocommerce/issues/27688.
Update DB version to 5.0.0.
wc_update_500_db_version() : mixed
Creates the refund and returns policy page.
wc_update_560_create_refund_returns_page() : mixed
See @link https://github.com/woocommerce/woocommerce/issues/29235.
Update DB version to 5.6.0.
wc_update_560_db_version() : mixed
Migrate rate limit options to the new table.
wc_update_600_migrate_rate_limit_options() : mixed
See @link https://github.com/woocommerce/woocommerce/issues/27103.
Update DB version to 6.0.0.
wc_update_600_db_version() : mixed
Create the product attributes lookup table and initiate its filling, unless the table had been already created manually (via the tools page).
wc_update_630_create_product_attributes_lookup_table() : false
Update DB version to 6.3.0.
wc_update_630_db_version() : mixed
Create the primary key for the product attributes lookup table if it doesn't exist already.
wc_update_640_add_primary_key_to_product_attributes_lookup_table() : bool
Update DB version to 6.4.0.
wc_update_640_db_version() : mixed
Add the standard WooCommerce upload directories to the Approved Product Download Directories list and start populating it based on existing product download URLs, but do not enable the feature (for existing installations, a site admin should review and make a conscious decision to enable).
wc_update_650_approved_download_directories() : mixed
In some cases, the approved download directories table may not have been successfully created during the update to 6.5.0. If this was the case we will need to re-initialize the feature.
wc_update_651_approved_download_directories() : mixed
Purges the comments count cache after 6.7.0 split reviews from the comments page.
wc_update_670_purge_comments_count_cache() : mixed
Remove unnecessary foreign keys.
wc_update_700_remove_download_log_fk() : void
Remove the transient data for recommended marketing extensions.
wc_update_700_remove_recommended_marketing_plugins_transient() : mixed
Update the New Zealand state codes in the database after they were updated in code to the CLDR standard.
wc_update_721_adjust_new_zealand_states() : mixed
Update the Ukraine state codes in the database after they were updated in code to the CLDR standard.
wc_update_721_adjust_ukraine_states() : mixed
Update the New Zealand state codes in the database after they were updated in code to the CLDR standard.
wc_update_722_adjust_new_zealand_states() : mixed
This is a simple wrapper for the corresponding 7.2.1 update function. The reason we do this (instead of reusing the original function directly) is for better traceability in the Action Scheduler log, in case of problems.
Update the Ukraine state codes in the database after they were updated in code to the CLDR standard.
wc_update_722_adjust_ukraine_states() : mixed
This is a simple wrapper for the corresponding 7.2.1 update function. The reason we do this (instead of reusing the original function directly) is for better traceability in the Action Scheduler log, in case of problems.
Add new columns date_paid and date_completed to wp_wc_order_stats table in order to provide the option of using the dates in the reports
wc_update_750_add_columns_to_order_stats_table() : mixed
Disable the experimental product management experience.
wc_update_750_disable_new_product_management_experience() : void
Remove the multichannel marketing feature flag and options. This feature is now enabled by default.
wc_update_770_remove_multichannel_marketing_feature_options() : mixed
Migrate transaction data which was being incorrectly stored in the postmeta table to HPOS tables.
wc_update_810_migrate_transactional_metadata_for_hpos() : bool
Remove the transient data for recommended marketing extensions.
wc_update_860_remove_recommended_marketing_plugins_transient() : mixed
This is removed because it is not used anymore.
It is replaced by woocommerce_admin_marketing_recommendations_specs
transient that is created by MarketingRecommendationsDataSourcePoller
.
Create an .htaccess file and an empty index.html file to prevent listing of the default transient files directory, if the directory exists.
wc_update_870_prevent_listing_of_transient_files_directory() : mixed
If it exists, remove and recreate the inbox note that asks users to connect to `Woo.com` so that the domain name is changed to the updated `WooCommerce.com`.
wc_update_890_update_connect_to_woocommerce_note() : mixed
Disables the PayPal Standard gateway for stores that aren't using it.
wc_update_890_update_paypal_standard_load_eligibility() : mixed
PayPal Standard has been deprecated since WooCommerce 5.5, but there are some stores that have it showing up in their list of available Payment methods even if it's not setup. In WooComerce 8.9 we will disable PayPal Standard for those stores to reduce the amount of new connections to the legacy gateway.
Shows an admin notice to inform the store owner that PayPal Standard has been disabled and suggests installing PayPal Payments.
Create the woocommerce_history_of_autoinstalled_plugins option if it doesn't exist as a copy of woocommerce_autoinstalled_plugins if it exists.
wc_update_891_create_plugin_autoinstall_history_option() : mixed
Add woocommerce_show_lys_tour.
wc_update_910_add_launch_your_store_tour_option() : mixed
Remove user meta associated with the keys '_last_order', '_order_count' and '_money_spent'.
wc_update_910_remove_obsolete_user_meta() : void
New keys are now used for these, to improve compatibility with multisite networks.
Prevent any user who cannot 'edit_posts' (subscribers, customers etc) from seeing the admin bar.
wc_disable_admin_bar(bool $show_admin_bar) : bool
Note: get_option( 'woocommerce_lock_down_admin', true ) is a deprecated option here for backwards compatibility. Defaults to true.
If should display admin bar.
Create a new customer.
wc_create_new_customer(string $email[, string $username = '' ][, string $password = '' ][, array<string|int, mixed> $args = array() ]) : int|WP_Error
Customer email.
Customer username.
Customer password.
List of arguments to pass to wp_insert_user()
.
Create a unique username for a new customer.
wc_create_new_customer_username(string $email[, array<string|int, mixed> $new_user_args = array() ][, string $suffix = '' ]) : string
New customer email address.
Array of new user args, maybe including first and last names.
Append string to username to make it unique.
Login a customer (set auth cookie and set global user object).
wc_set_customer_auth_cookie(int $customer_id) : mixed
Customer ID.
Get past orders (by email) and update them.
wc_update_new_customer_past_orders(int $customer_id) : int
Customer ID.
Order payment completed - This is a paying customer.
wc_paying_customer(int $order_id) : mixed
Order ID.
Checks if a user (by email or ID or both) has bought an item.
wc_customer_bought_product(string $customer_email, int $user_id, int $product_id) : bool
Customer email to check.
User ID to check.
Product ID to check.
Checks if the current user has a role.
wc_current_user_has_role(string $role) : bool
The role.
Checks if a user has a role.
wc_user_has_role(int|WP_User $user, string $role) : bool
The user.
The role.
Checks if a user has a certain capability.
wc_customer_has_capability(array<string|int, mixed> $allcaps, array<string|int, mixed> $caps, array<string|int, mixed> $args) : array<string|int, mixed>
All capabilities.
Capabilities.
Arguments.
Safe way of allowing shop managers restricted capabilities that will remove access to the capabilities if WooCommerce is deactivated.
wc_shop_manager_has_capability(array<string|int, bool> $allcaps, array<string|int, string> $caps, array<string|int, mixed> $args, WP_User $user) : array<string|int, bool>
Array of key/value pairs where keys represent a capability name and boolean values represent whether the user has that capability.
Required primitive capabilities for the requested capability.
Arguments that accompany the requested capability check.
The user object.
Modify the list of editable roles to prevent non-admin adding admin users.
wc_modify_editable_roles(array<string|int, mixed> $roles) : array<string|int, mixed>
Roles.
Modify capabilities to prevent non-admin users editing admin users.
wc_modify_map_meta_cap(array<string|int, mixed> $caps, string $cap, int $user_id, array<string|int, mixed> $args) : array<string|int, mixed>
$args[0] will be the user being edited in this case.
Array of caps.
Name of the cap we are checking.
ID of the user being checked against.
Arguments.
Get customer download permissions from the database.
wc_get_customer_download_permissions(int $customer_id) : array<string|int, mixed>
Customer/User ID.
Get customer available downloads.
wc_get_customer_available_downloads(int $customer_id) : array<string|int, mixed>
Customer/User ID.
Get total spent by customer.
wc_get_customer_total_spent(int $user_id) : string
User ID.
Get total orders by customer.
wc_get_customer_order_count(int $user_id) : int
User ID.
Reset _customer_user on orders when a user is deleted.
wc_reset_order_customer_id_on_deleted_user(int $user_id) : mixed
User ID.
Get review verification status.
wc_review_is_from_verified_owner(int $comment_id) : bool
Comment ID.
Disable author archives for customers.
wc_disable_author_archives_for_customers() : mixed
Hooks into the `profile_update` hook to set the user last updated timestamp.
wc_update_profile_last_update_time(int $user_id, array<string|int, mixed> $old) : mixed
The user that was updated.
The profile fields pre-change.
Hooks into the update user meta function to set the user last updated timestamp.
wc_meta_update_last_update_time(int $meta_id, int $user_id, string $meta_key, mixed $_meta_value) : mixed
ID of the meta object that was changed.
The user that was updated.
Name of the meta key that was changed.
Value of the meta that was changed.
Sets a user's "last update" time to the current timestamp.
wc_set_user_last_update_time(int $user_id) : mixed
The user to set a timestamp for.
Get customer saved payment methods list.
wc_get_customer_saved_methods_list(int $customer_id) : array<string|int, mixed>
Customer ID.
Get info about customer's last order.
wc_get_customer_last_order(int $customer_id) : WC_Order|bool
Customer ID.
Add support for searching by display_name.
wc_user_search_columns(array<string|int, mixed> $search_columns) : array<string|int, mixed>
Column names.
When a user is deleted in WordPress, delete corresponding WooCommerce data.
wc_delete_user_data(int $user_id) : mixed
User ID being deleted.
Store user agents. Used for tracker.
wc_maybe_store_user_agent(string $user_login, int|object $user) : mixed
User login.
User.
Update logic triggered on login.
wc_user_logged_in(string $user_login, object $user) : mixed
User login.
User.
Update when the user was last active.
wc_current_user_is_active() : mixed
Set the user last active timestamp to now.
wc_update_user_last_active(int $user_id) : mixed
User ID to mark active.
Translate WC roles using the woocommerce textdomain.
wc_translate_user_roles(string $translation, string $text, string $context, string $domain) : string
Translated text.
Text to translate.
Context information for the translators.
Text domain. Unique identifier for retrieving translated strings.
Process the web hooks at the end of the request.
wc_webhook_execute_queue() : mixed
Process webhook delivery.
wc_webhook_process_delivery(WC_Webhook $webhook, array<string|int, mixed> $arg) : mixed
Webhook instance.
Delivery arguments.
Wrapper function to execute the `woocommerce_deliver_webhook_async` cron.
wc_deliver_webhook_async(int $webhook_id, mixed $arg) : mixed
hook, see WC_Webhook::process().
Webhook ID to deliver.
Hook argument.
Check if the given topic is a valid webhook topic, a topic is valid if:
wc_is_webhook_valid_topic(string $topic) : bool
action.woocommerce_
or action.wc_
.Webhook topic.
Check if given status is a valid webhook status.
wc_is_webhook_valid_status(string $status) : bool
Status to check.
Get Webhook statuses.
wc_get_webhook_statuses() : array<string|int, mixed>
Load webhooks.
wc_load_webhooks([string $status = '' ][, null|int $limit = null ]) : bool
Optional - status to filter results by. Must be a key in return value of @see wc_get_webhook_statuses(). @since 3.5.0.
Limit number of webhooks loaded. @since 3.6.0.
Get webhook.
wc_get_webhook(int|WC_Webhook $id) : WC_Webhook|null
Webhook ID or object.
Get webhoook REST API versions.
wc_get_webhook_rest_api_versions() : array<string|int, mixed>
Register Widgets.
wc_register_widgets() : mixed
Register a checkout field.
woocommerce_register_additional_checkout_field(array<string|int, mixed> $options) : mixed
Field arguments. See CheckoutFields::register_checkout_field() for details.
Register a checkout field.
__experimental_woocommerce_blocks_register_checkout_field(array<string|int, mixed> $options) : mixed
Field arguments. See CheckoutFields::register_checkout_field() for details.
Print client-side navigation meta tag (hard-coded for now).
woocommerce_interactivity_add_client_side_navigation_meta_tag() : mixed
Merge data into the state with the given namespace.
wc_initial_state(string $namespace[, array<string|int, mixed> $data = null ]) : array<string|int, mixed>
Namespace.
State to merge.
Move interactive scripts to the footer. This is a temporary measure to make it work with `wc_store` and it should be replaced with deferred scripts or modules.
woocommerce_interactivity_move_interactive_scripts_to_the_footer() : mixed
Register the Interactivity API runtime and make it available to be enqueued as a dependency in interactive blocks.
woocommerce_interactivity_register_runtime() : mixed
Register endpoint data under a specified namespace.
woocommerce_store_api_register_endpoint_data(array<string|int, mixed> $args) : mixed
Args to pass to register_endpoint_data.
Add callback functions that can be executed by the cart/extensions endpoint.
woocommerce_store_api_register_update_callback(array<string|int, mixed> $args) : mixed
Args to pass to register_update_callback.
Registers and validates payment requirements callbacks.
woocommerce_store_api_register_payment_requirements(array<string|int, mixed> $args) : mixed
Args to pass to register_payment_requirements.
Returns a formatter instance.
woocommerce_store_api_get_formatter(string $name) : FormatterInterface
Formatter name.
Returns the main instance of WC.
WC() : WooCommerce
Returns the WooCommerce object container.
wc_get_container() : Container
Code in the includes
directory should use the container to get instances of classes in the src
directory.