WooCommerce Code Reference

Search results

Functions

Table of Contents

wc_maybe_define_constant() Define a constant if it is not already defined.
wc_create_order() Create a new order programmatically.
wc_update_order() Update an order. Uses wc_create_order.
wc_tokenize_path() Given a path, this will convert any of the subpaths into their corresponding tokens.
wc_untokenize_path() Given a tokenized path, this will expand the tokens to their full path.
wc_get_path_define_tokens() Fetches an array containing all of the configurable path constants to be used in tokenization.
wc_get_template_part() Get template part (for templates like the shop-loop).
wc_get_template() Get other templates (e.g. product attributes) passing attributes and including the file.
wc_get_template_html() Like wc_get_template, but returns the HTML instead of outputting.
wc_locate_template() Locate a template and return the path for inclusion.
wc_set_template_cache() Add a template to the template cache.
wc_clear_template_cache() Clear the template cache.
get_woocommerce_currency() Get Base Currency Code.
get_woocommerce_currencies() Get full list of currency codes.
get_woocommerce_currency_symbols() Get all available Currency symbols.
get_woocommerce_currency_symbol() Get Currency symbol.
wc_mail() Send HTML emails from WooCommerce.
wc_get_theme_support() Return "theme support" values from the current theme, if set.
wc_get_image_size() Get an image size by name or defined dimensions.
wc_enqueue_js() Queue some JavaScript code to be output in the footer.
wc_print_js() Output any queued javascript code in the footer.
wc_setcookie() Set a cookie - wrapper for setcookie using WP constants.
get_woocommerce_api_url() Get the URL to the WooCommerce REST API.
wc_get_log_file_path() Get a log file path.
wc_get_log_file_name() Get a log file name.
wc_get_page_children() Recursively get page children.
flush_rewrite_rules_on_shop_page_save() Flushes rewrite rules when the shop page (or it's children) gets saved.
wc_fix_rewrite_rules() Various rewrite rule fixes.
wc_fix_product_attachment_link() Prevent product attachment links from breaking when using complex rewrite structures.
wc_ms_protect_download_rewite_rules() Protect downloads from ms-files.php in multisite.
wc_format_country_state_string() Formats a string in the format COUNTRY:STATE into an array.
wc_get_base_location() Get the store's base location.
wc_get_customer_default_location() Get the customer's default location.
wc_get_user_agent() Get user agent string.
wc_rand_hash() Generate a rand hash.
wc_api_hash() WC API - Hash.
wc_array_cartesian() Find all possible combinations of values from the input array and return in a logical order.
wc_transaction_query() Run a MySQL transaction query, if supported.
wc_get_cart_url() Gets the url to the cart page.
wc_get_checkout_url() Gets the url to the checkout page.
woocommerce_register_shipping_method() Register a shipping method.
wc_get_shipping_zone() Get the shipping zone matching a given package from the cart.
wc_get_credit_card_type_label() Get a nice name for credit card providers.
wc_back_link() Outputs a "back" link so admin screens can easily jump back a page.
wc_help_tip() Display a WooCommerce help tip.
wc_get_wildcard_postcodes() Return a list of potential postcodes for wildcard searching.
wc_postcode_location_matcher() Used by shipping zones and taxes to compare a given $postcode to stored postcodes to find matches for numerical ranges, and wildcards.
wc_get_shipping_method_count() Gets number of shipping methods currently enabled. Used to identify if shipping is configured.
wc_set_time_limit() Wrapper for set_time_limit to see if it is enabled.
wc_nocache_headers() Wrapper for nocache_headers which also disables page caching.
wc_product_attribute_uasort_comparison() Used to sort products attributes with uasort.
wc_shipping_zone_method_order_uasort_comparison() Used to sort shipping zone methods with uasort.
wc_checkout_fields_uasort_comparison() User to sort checkout fields based on priority with uasort.
wc_uasort_comparison() User to sort two values with ausort.
wc_ascii_uasort_comparison() Sort values based on ascii, usefull for special chars in strings.
wc_get_tax_rounding_mode() Get rounding mode for internal tax calculations.
wc_get_rounding_precision() Get rounding precision for internal WC calculations.
wc_add_number_precision() Add precision to a number and return a number.
wc_remove_number_precision() Remove precision from a number and return a float.
wc_add_number_precision_deep() Add precision to an array of number and return an array of int.
wc_remove_number_precision_deep() Remove precision from an array of number and return an array of int.
wc_get_logger() Get a shared logger instance.
wc_cleanup_logs() Trigger logging cleanup using the logging class.
wc_print_r() Prints human-readable information about a variable.
wc_register_default_log_handler() Registers the default log handler.
wc_list_pluck() Based on wp_list_pluck, this calls a method instead of returning a property.
wc_get_permalink_structure() Get permalink settings for things like products and taxonomies.
wc_switch_to_site_locale() Switch WooCommerce to site language.
wc_restore_locale() Switch WooCommerce language to original.
wc_make_phone_clickable() Convert plaintext phone number to clickable phone number.
wc_get_post_data_by_key() Get an item of post data if set, otherwise return a default value.
wc_get_var() Get data if set, otherwise return a default value or null. Prevents notices when data is not set.
wc_enable_wc_plugin_headers() Read in WooCommerce headers when reading plugin headers.
wc_prevent_dangerous_auto_updates() Prevent auto-updating the WooCommerce plugin on major releases if there are untested extensions active.
wc_delete_expired_transients() Delete expired transients.
wc_get_relative_url() Make a URL relative, if possible.
wc_is_external_resource() See if a resource is remote.
wc_is_active_theme() See if theme/s is activate or not.
wc_is_wp_default_theme_active() Is the site using a default WP theme?
wc_cleanup_session_data() Cleans up session data - cron callback.
wc_decimal_to_fraction() Convert a decimal (e.g. 3.5) to a fraction (e.g. 7/2).
wc_round_discount() Round discount.
wc_selected() 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_get_server_database_version() Retrieves the MySQL server version. Based on $wpdb.
wc_load_cart() Initialize and load the cart functionality.
wc_is_running_from_async_action_scheduler() Test whether the context of execution comes from async action scheduler.
wc_do_deprecated_action() Runs a deprecated action with notice only if used.
wc_deprecated_function() Wrapper for deprecated functions so we can apply some extra logic.
wc_deprecated_hook() Wrapper for deprecated hook so we can apply some extra logic.
wc_caught_exception() When catching an exception, this allows us to log it if unexpected.
wc_doing_it_wrong() Wrapper for _doing_it_wrong().
wc_deprecated_argument() Wrapper for deprecated arguments so we can apply some extra logic.
woocommerce_show_messages()
woocommerce_weekend_area_js()
woocommerce_tooltip_js()
woocommerce_datepicker_js()
woocommerce_admin_scripts()
woocommerce_create_page()
woocommerce_readfile_chunked()
woocommerce_format_total() Formal total costs - format to the number of decimal places for the base currency.
woocommerce_get_formatted_product_name() Get product name with extra details such as SKU price and attributes. Used within admin.
woocommerce_legacy_paypal_ipn() Handle IPN requests for the legacy paypal gateway by calling gateways manually if needed.
get_product()
woocommerce_protected_product_add_to_cart()
woocommerce_empty_cart()
woocommerce_load_persistent_cart()
woocommerce_add_to_cart_message()
woocommerce_clear_cart_after_payment()
woocommerce_cart_totals_subtotal_html()
woocommerce_cart_totals_shipping_html()
woocommerce_cart_totals_coupon_html()
woocommerce_cart_totals_order_total_html()
woocommerce_cart_totals_fee_html()
woocommerce_cart_totals_shipping_method_label()
woocommerce_get_template_part()
woocommerce_get_template()
woocommerce_locate_template()
woocommerce_mail()
woocommerce_disable_admin_bar()
woocommerce_create_new_customer()
woocommerce_set_customer_auth_cookie()
woocommerce_update_new_customer_past_orders()
woocommerce_paying_customer()
woocommerce_customer_bought_product()
woocommerce_customer_has_capability()
woocommerce_sanitize_taxonomy_name()
woocommerce_get_filename_from_url()
woocommerce_get_dimension()
woocommerce_get_weight()
woocommerce_trim_zeros()
woocommerce_round_tax_total()
woocommerce_format_decimal()
woocommerce_clean()
woocommerce_array_overlay()
woocommerce_price()
woocommerce_let_to_num()
woocommerce_date_format()
woocommerce_time_format()
woocommerce_timezone_string()
woocommerce_rgb_from_hex()
woocommerce_hex_darker()
woocommerce_hex_lighter()
woocommerce_light_or_dark()
woocommerce_format_hex()
woocommerce_get_order_id_by_order_key()
woocommerce_downloadable_file_permission()
woocommerce_downloadable_product_permissions()
woocommerce_add_order_item()
woocommerce_delete_order_item()
woocommerce_update_order_item_meta()
woocommerce_add_order_item_meta()
woocommerce_delete_order_item_meta()
woocommerce_get_order_item_meta()
woocommerce_cancel_unpaid_orders()
woocommerce_processing_order_count()
woocommerce_get_page_id()
woocommerce_get_endpoint_url()
woocommerce_lostpassword_url()
woocommerce_customer_edit_account_url()
woocommerce_nav_menu_items()
woocommerce_nav_menu_item_classes()
woocommerce_list_pages()
woocommerce_product_dropdown_categories()
woocommerce_walk_category_dropdown_tree()
woocommerce_taxonomy_metadata_wpdbfix()
wc_taxonomy_metadata_wpdbfix()
woocommerce_order_terms()
woocommerce_set_term_order()
woocommerce_terms_clauses()
_woocommerce_term_recount()
woocommerce_recount_after_stock_change()
woocommerce_change_term_counts()
woocommerce_get_product_ids_on_sale()
woocommerce_get_featured_product_ids()
woocommerce_get_product_terms()
woocommerce_product_post_type_link()
woocommerce_placeholder_img_src()
woocommerce_placeholder_img()
woocommerce_get_formatted_variation()
woocommerce_scheduled_sales()
woocommerce_get_attachment_image_attributes()
woocommerce_prepare_attachment_for_js()
woocommerce_track_product_view()
woocommerce_compile_less_styles()
woocommerce_calc_shipping_backwards_compatibility() 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_get_product_schema()
_wc_save_product_price() Save product price.
wc_get_customer_avatar_url() Return customer avatar URL.
wc_get_core_supported_themes() WooCommerce Core Supported Themes.
wc_get_min_max_price_meta_query() Get min/max price meta query args.
wc_taxonomy_metadata_update_content_for_split_terms() When a term is split, ensure meta data maintained.
update_woocommerce_term_meta() WooCommerce Term Meta API.
add_woocommerce_term_meta() WooCommerce Term Meta API.
delete_woocommerce_term_meta() WooCommerce Term Meta API
get_woocommerce_term_meta() WooCommerce Term Meta API
wc_page_endpoint_title() Replace a page title with the endpoint title.
wc_get_page_id() 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_permalink() Retrieve page permalink.
wc_get_endpoint_url() Get endpoint URL.
wc_nav_menu_items() Hide menu items conditionally.
wc_nav_menu_item_classes() Fix active class in nav for shop page.
wc_list_pages() Fix active class in wp_list_pages for shop page.
wc_template_redirect() Handle redirects before content is output - hooked into template_redirect so is_page works.
wc_send_frame_options_header() When loading sensitive checkout or account pages, send a HTTP header to limit rendering of pages to same origin iframes for security reasons.
wc_prevent_endpoint_indexing() No index our endpoints.
wc_prevent_adjacent_posts_rel_link_wp_head() Remove adjacent_posts_rel_link_wp_head - pointless for products.
wc_gallery_noscript() Show the gallery if JS is disabled.
wc_setup_product_data() When the_post is called, put product data into a global.
wc_setup_loop() Sets up the woocommerce_loop global from the passed args or from the main query.
wc_reset_loop() Resets the woocommerce_loop global.
wc_get_loop_prop() Gets a property from the woocommerce_loop global.
wc_set_loop_prop() Sets a property in the woocommerce_loop global.
wc_set_loop_product_visibility() Set the current visbility for a product in the woocommerce_loop global.
wc_get_loop_product_visibility() Gets the cached current visibility for a product from the woocommerce_loop global.
woocommerce_product_loop() Should the WooCommerce loop be displayed?
wc_generator_tag() Output generator tag to aid debugging.
wc_body_class() Add body classes for WC pages.
wc_no_js() NO JS handling.
wc_product_cat_class() Display the classes for the product cat div.
wc_get_default_products_per_row() Get the default columns setting - this is how many products will be shown per row in loops.
wc_get_default_product_rows_per_page() Get the default rows setting - this is how many product rows will be shown in loops.
wc_reset_product_grid_settings() Reset the product grid settings when a new theme is activated.
wc_get_loop_class() Get classname for woocommerce loops.
wc_get_product_cat_class() Get the classes for the product cat div.
wc_product_post_class() Adds extra post classes for products via the WordPress post_class hook, if used.
wc_get_product_taxonomy_class() Get product taxonomy HTML classes.
wc_get_product_class() Retrieves the classes for the post div as an array.
wc_product_class() Display the classes for the product div.
wc_query_string_form_fields() Outputs hidden form inputs for each query string variable.
wc_terms_and_conditions_page_id() Get the terms and conditons page ID.
wc_privacy_policy_page_id() Get the privacy policy page ID.
wc_terms_and_conditions_checkbox_enabled() See if the checkbox is enabled or not based on the existance of the terms page and checkbox text.
wc_get_terms_and_conditions_checkbox_text() Get the terms and conditons checkbox text, if set.
wc_get_privacy_policy_text() Get the privacy policy text, if set.
wc_terms_and_conditions_checkbox_text() Output t&c checkbox text.
wc_terms_and_conditions_page_content() Output t&c page's content (if set). The page can be set from checkout settings.
wc_checkout_privacy_policy_text() Render privacy policy text on the checkout.
wc_registration_privacy_policy_text() Render privacy policy text on the register forms.
wc_privacy_policy_text() Output privacy policy text. This is custom text which can be added via the customizer/privacy settings section.
wc_replace_policy_page_link_placeholders() Replaces placeholders with links to WooCommerce policy pages.
woocommerce_content() Output WooCommerce content.
woocommerce_output_content_wrapper() Output the start of the page wrapper.
woocommerce_output_content_wrapper_end() Output the end of the page wrapper.
woocommerce_get_sidebar() Get the shop sidebar template.
woocommerce_demo_store() Adds a demo store banner to the site if enabled.
woocommerce_page_title() Page Title function.
woocommerce_product_loop_start() Output the start of a product loop. By default this is a UL.
woocommerce_product_loop_end() Output the end of a product loop. By default this is a UL.
woocommerce_template_loop_product_title() Show the product title in the product loop. By default this is an H2.
woocommerce_template_loop_category_title() Show the subcategory title in the product loop.
woocommerce_template_loop_product_link_open() Insert the opening anchor tag for products in the loop.
woocommerce_template_loop_product_link_close() Insert the closing anchor tag for products in the loop.
woocommerce_template_loop_category_link_open() Insert the opening anchor tag for categories in the loop.
woocommerce_template_loop_category_link_close() Insert the closing anchor tag for categories in the loop.
woocommerce_taxonomy_archive_description() Show an archive description on taxonomy archives.
woocommerce_product_archive_description() Show a shop page description on product archives.
woocommerce_template_loop_add_to_cart() Get the add to cart template for the loop.
woocommerce_template_loop_product_thumbnail() Get the product thumbnail for the loop.
woocommerce_template_loop_price() Get the product price for the loop.
woocommerce_template_loop_rating() Display the average rating in the loop.
woocommerce_show_product_loop_sale_flash() Get the sale flash for the loop.
woocommerce_get_product_thumbnail() Get the product thumbnail, or the placeholder if not set.
woocommerce_result_count() Output the result count text (Showing x - x of x results).
woocommerce_catalog_ordering() Output the product sorting options.
woocommerce_pagination() Output the pagination.
woocommerce_show_product_images() Output the product image before the single product summary.
woocommerce_show_product_thumbnails() Output the product thumbnails.
wc_get_gallery_image_html() Get HTML for a gallery image.
woocommerce_output_product_data_tabs() Output the product tabs.
woocommerce_template_single_title() Output the product title.
woocommerce_template_single_rating() Output the product rating.
woocommerce_template_single_price() Output the product price.
woocommerce_template_single_excerpt() Output the product short description (excerpt).
woocommerce_template_single_meta() Output the product meta.
woocommerce_template_single_sharing() Output the product sharing.
woocommerce_show_product_sale_flash() Output the product sale flash.
woocommerce_template_single_add_to_cart() Trigger the single product add to cart action.
woocommerce_simple_add_to_cart() Output the simple product add to cart area.
woocommerce_grouped_add_to_cart() Output the grouped product add to cart area.
woocommerce_variable_add_to_cart() Output the variable product add to cart area.
woocommerce_external_add_to_cart() Output the external product add to cart area.
woocommerce_quantity_input() Output the quantity input for add to cart forms.
woocommerce_product_description_tab() Output the description tab content.
woocommerce_product_additional_information_tab() Output the attributes tab content.
woocommerce_default_product_tabs() Add default product tabs to product pages.
woocommerce_sort_product_tabs() Sort tabs by priority.
woocommerce_comments() Output the Review comments template.
woocommerce_review_display_gravatar() Display the review authors gravatar
woocommerce_review_display_rating() Display the reviewers star rating
woocommerce_review_display_meta() Display the review authors meta (name, verified owner, review date)
woocommerce_review_display_comment_text() Display the review content.
woocommerce_output_related_products() Output the related products.
woocommerce_related_products() Output the related products.
woocommerce_upsell_display() Output product up sells.
woocommerce_shipping_calculator() Output the cart shipping calculator.
woocommerce_cart_totals() Output the cart totals.
woocommerce_cross_sell_display() Output the cart cross-sells.
woocommerce_button_proceed_to_checkout() Output the proceed to checkout button.
woocommerce_widget_shopping_cart_button_view_cart() Output the view cart button.
woocommerce_widget_shopping_cart_proceed_to_checkout() Output the proceed to checkout button.
woocommerce_widget_shopping_cart_subtotal() Output to view cart subtotal.
woocommerce_mini_cart() Output the Mini-cart - used by cart widget.
woocommerce_login_form() Output the WooCommerce Login Form.
woocommerce_checkout_login_form() Output the WooCommerce Checkout Login Form.
woocommerce_breadcrumb() Output the WooCommerce Breadcrumb.
woocommerce_order_review() Output the Order review table for the checkout.
woocommerce_checkout_payment() Output the Payment Methods on the checkout.
woocommerce_checkout_coupon_form() Output the Coupon form for the checkout.
woocommerce_products_will_display() Check if we will be showing products or not (and not sub-categories only).
woocommerce_get_loop_display_mode() See what is going to display in the loop.
woocommerce_maybe_show_product_subcategories() Maybe display categories before, or instead of, a product loop.
woocommerce_product_subcategories() 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_output_product_categories() Display product sub categories as thumbnails.
woocommerce_get_product_subcategories() Get (and cache) product subcategories.
woocommerce_subcategory_thumbnail() Show subcategory thumbnails.
woocommerce_order_details_table() Displays order details in a table.
woocommerce_order_downloads_table() Displays order downloads in a table.
woocommerce_order_again_button() Display an 'order again' button on the view order page.
woocommerce_form_field() Outputs a checkout/address form field.
get_product_search_form() Display product search form.
woocommerce_output_auth_header() Output the Auth header.
woocommerce_output_auth_footer() Output the Auth footer.
woocommerce_single_variation() Output placeholders for the single variation.
woocommerce_single_variation_add_to_cart_button() Output the add to cart button for variations.
wc_dropdown_variation_attribute_options() Output a list of variation attributes for use in the cart forms.
woocommerce_account_content() My Account content output.
woocommerce_account_navigation() My Account navigation template.
woocommerce_account_orders() My Account > Orders template.
woocommerce_account_view_order() My Account > View order template.
woocommerce_account_downloads() My Account > Downloads template.
woocommerce_account_edit_address() My Account > Edit address template.
woocommerce_account_payment_methods() My Account > Downloads template.
woocommerce_account_add_payment_method() My Account > Add payment method template.
woocommerce_account_edit_account() My Account > Edit account template.
wc_no_products_found() Handles the loop when no products were found/no product exist.
wc_get_email_order_items() Get HTML for the order items to be shown in emails.
wc_display_item_meta() Display item meta data.
wc_display_item_downloads() Display item download links.
woocommerce_photoswipe() Get the shop sidebar template.
wc_display_product_attributes() Outputs a list of product attributes for a product.
wc_get_stock_html() Get HTML to show product stock.
wc_get_rating_html() Get HTML for ratings.
wc_get_star_rating_html() Get HTML for star rating.
wc_get_price_html_from_text() Returns a 'from' prefix if you want to show where prices start at.
wc_logout_url() Get logout endpoint.
wc_empty_cart_message() Show notice if cart is empty.
wc_page_noindex() Disable search engines indexing core, dynamic, cart/checkout pages.
wc_get_theme_slug_for_templates() Get a slug identifying the current theme.
wc_get_formatted_cart_item_data() Gets and formats a list of cart item data + variations for display on the frontend.
wc_get_cart_remove_url() Gets the url to remove an item from the cart.
wc_get_cart_undo_url() Gets the url to re-add an item into the cart.
woocommerce_output_all_notices() Outputs all queued notices on WC pages.
wc_products_rss_feed() Products RSS Feed.
woocommerce_reset_loop() Reset the loop's index and columns when we're done outputting a product loop.
woocommerce_product_reviews_tab() Output the reviews tab content.
wc_get_pay_buttons() Display pay buttons HTML.

Functions

wc_maybe_define_constant()

Define a constant if it is not already defined.

wc_maybe_define_constant( $name : string , $value : mixed ) : mixed
Parameters
$name : string

Constant name.

$value : mixed

Value.

Tags
since
Return values
mixed

wc_create_order()

Create a new order programmatically.

wc_create_order( [ $args : array = array() ] ) : WC_Order|WP_Error

Returns a new order object on success which can then be used to add additional data.

Parameters
$args : array = array()

Order arguments.

Return values
WC_Order|WP_Error

wc_update_order()

Update an order. Uses wc_create_order.

wc_update_order( $args : array ) : WC_Order|WP_Error
Parameters
$args : array

Order arguments.

Return values
WC_Order|WP_Error

wc_tokenize_path()

Given a path, this will convert any of the subpaths into their corresponding tokens.

wc_tokenize_path( $path : string , $path_tokens : array ) : string
Parameters
$path : string

The absolute path to tokenize.

$path_tokens : array

An array keyed with the token, containing paths that should be replaced.

Tags
since
Return values
string

The tokenized path.

wc_untokenize_path()

Given a tokenized path, this will expand the tokens to their full path.

wc_untokenize_path( $path : string , $path_tokens : array ) : string
Parameters
$path : string

The absolute path to expand.

$path_tokens : array

An array keyed with the token, containing paths that should be expanded.

Tags
since
Return values
string

The absolute path.

wc_get_path_define_tokens()

Fetches an array containing all of the configurable path constants to be used in tokenization.

wc_get_path_define_tokens( ) : array
Return values
array

The key is the define and the path is the constant.

wc_get_template_part()

Get template part (for templates like the shop-loop).

wc_get_template_part( $slug : mixed [, $name : string = '' ] ) : mixed

WC_TEMPLATE_DEBUG_MODE will prevent overrides in themes from taking priority.

Parameters
$slug : mixed

Template slug.

$name : string = ''

Template name (default: '').

Return values
mixed

wc_get_template()

Get other templates (e.g. product attributes) passing attributes and including the file.

wc_get_template( $template_name : string [, $args : array = array() ] [, $template_path : string = '' ] [, $default_path : string = '' ] ) : mixed
Parameters
$template_name : string

Template name.

$args : array = array()

Arguments. (default: array).

$template_path : string = ''

Template path. (default: '').

$default_path : string = ''

Default path. (default: '').

Return values
mixed

wc_get_template_html()

Like wc_get_template, but returns the HTML instead of outputting.

wc_get_template_html( $template_name : string [, $args : array = array() ] [, $template_path : string = '' ] [, $default_path : string = '' ] ) : string
Parameters
$template_name : string

Template name.

$args : array = array()

Arguments. (default: array).

$template_path : string = ''

Template path. (default: '').

$default_path : string = ''

Default path. (default: '').

Tags
see
since
Return values
string

wc_locate_template()

Locate a template and return the path for inclusion.

wc_locate_template( $template_name : string [, $template_path : string = '' ] [, $default_path : string = '' ] ) : string

This is the load order:

yourtheme/$template_path/$template_name yourtheme/$template_name $default_path/$template_name

Parameters
$template_name : string

Template name.

$template_path : string = ''

Template path. (default: '').

$default_path : string = ''

Default path. (default: '').

Return values
string

wc_set_template_cache()

Add a template to the template cache.

wc_set_template_cache( $cache_key : string , $template : string ) : mixed
Parameters
$cache_key : string

Object cache key.

$template : string

Located template.

Tags
since
Return values
mixed

wc_clear_template_cache()

Clear the template cache.

wc_clear_template_cache( ) : mixed
Tags
since
Return values
mixed

get_woocommerce_currency()

Get Base Currency Code.

get_woocommerce_currency( ) : string
Return values
string

get_woocommerce_currency_symbol()

Get Currency symbol.

get_woocommerce_currency_symbol( [ $currency : string = '' ] ) : string

Currency symbols and names should follow the Unicode CLDR recommendation (http://cldr.unicode.org/translation/currency-names)

Parameters
$currency : string = ''

Currency. (default: '').

Return values
string

wc_mail()

Send HTML emails from WooCommerce.

wc_mail( $to : mixed , $subject : mixed , $message : mixed [, $headers : string = "Content-Type: text/html\r\n" ] [, $attachments : string = '' ] ) : bool
Parameters
$to : mixed

Receiver.

$subject : mixed

Subject.

$message : mixed

Message.

$headers : string = "Content-Type: text/html\r\n"

Headers. (default: "Content-Type: text/html\r\n").

$attachments : string = ''

Attachments. (default: "").

Return values
bool

wc_get_theme_support()

Return "theme support" values from the current theme, if set.

wc_get_theme_support( [ $prop : string = '' ] [, $default : mixed = null ] ) : mixed
Parameters
$prop : string = ''

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.

$default : mixed = null

Optional value to return if the theme does not declare support for a prop.

Tags
since
Return values
mixed

Value of prop(s).

wc_get_image_size()

Get an image size by name or defined dimensions.

wc_get_image_size( $image_size : array|string ) : array

The returned variable is filtered by woocommerce_get_imagesize{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.

Parameters
$image_size : array|string

Name of the image size to get, or an array of dimensions.

Return values
array

Array of dimensions including width, height, and cropping mode. Cropping mode is 0 for no crop, and 1 for hard crop.

wc_enqueue_js()

Queue some JavaScript code to be output in the footer.

wc_enqueue_js( $code : string ) : mixed
Parameters
$code : string

Code.

Return values
mixed

wc_print_js()

Output any queued javascript code in the footer.

wc_print_js( ) : mixed
Return values
mixed

wc_setcookie()

Set a cookie - wrapper for setcookie using WP constants.

wc_setcookie( $name : string , $value : string , $expire : int [, $secure : bool = false ] [, $httponly : bool = false ] ) : mixed
Parameters
$name : string

Name of the cookie being set.

$value : string

Value of the cookie.

$expire : int

Expiry of the cookie.

$secure : bool = false

Whether the cookie should be served only over https.

$httponly : bool = false

Whether the cookie is only accessible over HTTP, not scripting languages like JavaScript. @since 3.6.0.

Return values
mixed

get_woocommerce_api_url()

Get the URL to the WooCommerce REST API.

get_woocommerce_api_url( $path : string ) : string
Parameters
$path : string

an endpoint to include in the URL.

Tags
since
Return values
string

the URL.

wc_get_log_file_path()

Get a log file path.

wc_get_log_file_path( $handle : string ) : string
Parameters
$handle : string

name.

Tags
since
Return values
string

the log file path.

wc_get_log_file_name()

Get a log file name.

wc_get_log_file_name( $handle : string ) : string
Parameters
$handle : string

Name.

Tags
since
Return values
string

The log file name.

wc_get_page_children()

Recursively get page children.

wc_get_page_children( $page_id : int ) : int[]
Parameters
$page_id : int

Page ID.

Return values
int[]

flush_rewrite_rules_on_shop_page_save()

Flushes rewrite rules when the shop page (or it's children) gets saved.

flush_rewrite_rules_on_shop_page_save( ) : mixed
Return values
mixed

wc_fix_rewrite_rules()

Various rewrite rule fixes.

wc_fix_rewrite_rules( $rules : array ) : array
Parameters
$rules : array

Rules.

Tags
since
Return values
array

wc_fix_product_attachment_link()

Prevent product attachment links from breaking when using complex rewrite structures.

wc_fix_product_attachment_link( $link : string , $post_id : int ) : string
Parameters
$link : string

Link.

$post_id : int

Post ID.

Return values
string

wc_ms_protect_download_rewite_rules()

Protect downloads from ms-files.php in multisite.

wc_ms_protect_download_rewite_rules( $rewrite : string ) : string
Parameters
$rewrite : string

rewrite rules.

Return values
string

wc_format_country_state_string()

Formats a string in the format COUNTRY:STATE into an array.

wc_format_country_state_string( $country_string : string ) : array
Parameters
$country_string : string

Country string.

Tags
since
Return values
array

wc_get_base_location()

Get the store's base location.

wc_get_base_location( ) : array
Tags
since
Return values
array

wc_get_customer_default_location()

Get the customer's default location.

wc_get_customer_default_location( ) : array

Filtered, and set to base location or left blank. If cache-busting, this should only be used when 'location' is set in the querystring.

Tags
since
Return values
array

wc_get_user_agent()

Get user agent string.

wc_get_user_agent( ) : string
Tags
since
Return values
string

wc_rand_hash()

Generate a rand hash.

wc_rand_hash( ) : string
Tags
since
Return values
string

wc_api_hash()

WC API - Hash.

wc_api_hash( $data : string ) : string
Parameters
$data : string

Message to be hashed.

Tags
since
Return values
string

wc_array_cartesian()

Find all possible combinations of values from the input array and return in a logical order.

wc_array_cartesian( $input : array ) : array
Parameters
$input : array

Input.

Tags
since
Return values
array

wc_transaction_query()

Run a MySQL transaction query, if supported.

wc_transaction_query( [ $type : string = 'start' ] [, $force : bool = false ] ) : mixed
Parameters
$type : string = 'start'

Types: start (default), commit, rollback.

$force : bool = false

use of transactions.

Tags
since
Return values
mixed

wc_get_cart_url()

Gets the url to the cart page.

wc_get_cart_url( ) : string
Tags
since
Return values
string

Url to cart page

wc_get_checkout_url()

Gets the url to the checkout page.

wc_get_checkout_url( ) : string
Tags
since
Return values
string

Url to checkout page

woocommerce_register_shipping_method()

Register a shipping method.

woocommerce_register_shipping_method( $shipping_method : string|object ) : mixed
Parameters
$shipping_method : string|object

class name (string) or a class object.

Tags
since
Return values
mixed

wc_get_shipping_zone()

Get the shipping zone matching a given package from the cart.

wc_get_shipping_zone( $package : array ) : WC_Shipping_Zone
Parameters
$package : array

Shipping package.

Tags
since
uses
Return values
WC_Shipping_Zone

wc_get_credit_card_type_label()

Get a nice name for credit card providers.

wc_get_credit_card_type_label( $type : string ) : string
Parameters
$type : string

Provider Slug/Type.

Tags
since
Return values
string

wc_back_link()

Outputs a "back" link so admin screens can easily jump back a page.

wc_back_link( $label : string , $url : string ) : mixed
Parameters
$label : string

Title of the page to return to.

$url : string

URL of the page to return to.

Return values
mixed

wc_help_tip()

Display a WooCommerce help tip.

wc_help_tip( $tip : string [, $allow_html : bool = false ] ) : string
Parameters
$tip : string

Help tip text.

$allow_html : bool = false

Allow sanitized HTML if true or escape.

Tags
since
Return values
string

wc_get_wildcard_postcodes()

Return a list of potential postcodes for wildcard searching.

wc_get_wildcard_postcodes( $postcode : string [, $country : string = '' ] ) : string[]
Parameters
$postcode : string

Postcode.

$country : string = ''

Country to format postcode for matching.

Tags
since
Return values
string[]

wc_postcode_location_matcher()

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( $postcode : string , $objects : array , $object_id_key : string , $object_compare_key : string [, $country : string = '' ] ) : array
Parameters
$postcode : string

Postcode you want to match against stored postcodes.

$objects : array

Array of postcode objects from Database.

$object_id_key : string

DB column name for the ID.

$object_compare_key : string

DB column name for the value.

$country : string = ''

Country from which this postcode belongs. Allows for formatting.

Tags
since
Return values
array

Array of matching object ID and matching values.

wc_get_shipping_method_count()

Gets number of shipping methods currently enabled. Used to identify if shipping is configured.

wc_get_shipping_method_count( [ $include_legacy : bool = false ] [, $enabled_only : bool = false ] ) : int
Parameters
$include_legacy : bool = false

Count legacy shipping methods too.

$enabled_only : bool = false

Whether non-legacy shipping methods should be restricted to enabled ones. It doesn't affect legacy shipping methods. @since 4.3.0.

Tags
since
Return values
int

wc_set_time_limit()

Wrapper for set_time_limit to see if it is enabled.

wc_set_time_limit( $limit : int ) : mixed
Parameters
$limit : int

Time limit.

Tags
since
Return values
mixed

wc_nocache_headers()

Wrapper for nocache_headers which also disables page caching.

wc_nocache_headers( ) : mixed
Tags
since
Return values
mixed

wc_product_attribute_uasort_comparison()

Used to sort products attributes with uasort.

wc_product_attribute_uasort_comparison( $a : array , $b : array ) : int
Parameters
$a : array

First attribute to compare.

$b : array

Second attribute to compare.

Tags
since
Return values
int

wc_shipping_zone_method_order_uasort_comparison()

Used to sort shipping zone methods with uasort.

wc_shipping_zone_method_order_uasort_comparison( $a : array , $b : array ) : int
Parameters
$a : array

First shipping zone method to compare.

$b : array

Second shipping zone method to compare.

Tags
since
Return values
int

wc_checkout_fields_uasort_comparison()

User to sort checkout fields based on priority with uasort.

wc_checkout_fields_uasort_comparison( $a : array , $b : array ) : int
Parameters
$a : array

First field to compare.

$b : array

Second field to compare.

Tags
since
Return values
int

wc_uasort_comparison()

User to sort two values with ausort.

wc_uasort_comparison( $a : int , $b : int ) : int
Parameters
$a : int

First value to compare.

$b : int

Second value to compare.

Tags
since
Return values
int

wc_ascii_uasort_comparison()

Sort values based on ascii, usefull for special chars in strings.

wc_ascii_uasort_comparison( $a : string , $b : string ) : int
Parameters
$a : string

First value.

$b : string

Second value.

Return values
int

wc_get_tax_rounding_mode()

Get rounding mode for internal tax calculations.

wc_get_tax_rounding_mode( ) : int
Tags
since
Return values
int

wc_get_rounding_precision()

Get rounding precision for internal WC calculations.

wc_get_rounding_precision( ) : int

Will increase the precision of wc_get_price_decimals by 2 decimals, unless WC_ROUNDING_PRECISION is set to a higher number.

Tags
since
Return values
int

wc_add_number_precision()

Add precision to a number and return a number.

wc_add_number_precision( $value : float [, $round : bool = true ] ) : int|float
Parameters
$value : float

Number to add precision to.

$round : bool = true

If should round after adding precision.

Tags
since
Return values
int|float

wc_remove_number_precision()

Remove precision from a number and return a float.

wc_remove_number_precision( $value : float ) : float
Parameters
$value : float

Number to add precision to.

Tags
since
Return values
float

wc_add_number_precision_deep()

Add precision to an array of number and return an array of int.

wc_add_number_precision_deep( $value : array [, $round : bool = true ] ) : int|array
Parameters
$value : array

Number to add precision to.

$round : bool = true

Should we round after adding precision?.

Tags
since
Return values
int|array

wc_remove_number_precision_deep()

Remove precision from an array of number and return an array of int.

wc_remove_number_precision_deep( $value : array ) : int|array
Parameters
$value : array

Number to add precision to.

Tags
since
Return values
int|array

wc_get_logger()

Get a shared logger instance.

wc_get_logger( ) : WC_Logger

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.
Tags
see
Return values
WC_Logger

wc_cleanup_logs()

Trigger logging cleanup using the logging class.

wc_cleanup_logs( ) : mixed
Tags
since
Return values
mixed

wc_print_r()

Prints human-readable information about a variable.

wc_print_r( $expression : mixed [, $return : bool = false ] ) : string|bool

Some server environments blacklist some debugging functions. This function provides a safe way to turn an expression into a printable, readable form without calling blacklisted functions.

Parameters
$expression : mixed

The expression to be printed.

$return : bool = false

Optional. Default false. Set to true to return the human-readable string.

Tags
since
Return values
string|bool

False if expression could not be printed. True if the expression was printed. If $return is true, a string representation will be returned.

wc_register_default_log_handler()

Registers the default log handler.

wc_register_default_log_handler( $handlers : array ) : array
Parameters
$handlers : array

Handlers.

Tags
since
Return values
array

wc_list_pluck()

Based on wp_list_pluck, this calls a method instead of returning a property.

wc_list_pluck( $list : array , $callback_or_field : int|string [, $index_key : int|string = null ] ) : array
Parameters
$list : array

List of objects or arrays.

$callback_or_field : int|string

Callback method from the object to place instead of the entire object.

$index_key : int|string = null

Optional. Field from the object to use as keys for the new array. Default null.

Tags
since
Return values
array

Array of values.

wc_get_permalink_structure()

Get permalink settings for things like products and taxonomies.

wc_get_permalink_structure( ) : array

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.

Tags
since
Return values
array

wc_switch_to_site_locale()

Switch WooCommerce to site language.

wc_switch_to_site_locale( ) : mixed
Tags
since
Return values
mixed

wc_restore_locale()

Switch WooCommerce language to original.

wc_restore_locale( ) : mixed
Tags
since
Return values
mixed

wc_get_post_data_by_key()

Get an item of post data if set, otherwise return a default value.

wc_get_post_data_by_key( $key : string [, $default : string = '' ] ) : mixed
Parameters
$key : string

Meta key.

$default : string = ''

Default value.

Tags
since
Return values
mixed

Value sanitized by wc_clean.

wc_get_var()

Get data if set, otherwise return a default value or null. Prevents notices when data is not set.

wc_get_var( &$var : mixed [, $default : string = null ] ) : mixed
Parameters
$var : mixed

Variable.

$default : string = null

Default value.

Tags
since
Return values
mixed

wc_enable_wc_plugin_headers()

Read in WooCommerce headers when reading plugin headers.

wc_enable_wc_plugin_headers( $headers : array ) : array
Parameters
$headers : array

Headers.

Tags
since
Return values
array

wc_prevent_dangerous_auto_updates()

Prevent auto-updating the WooCommerce plugin on major releases if there are untested extensions active.

wc_prevent_dangerous_auto_updates( $should_update : bool , $plugin : object ) : bool
Parameters
$should_update : bool

If should update.

$plugin : object

Plugin data.

Tags
since
Return values
bool

wc_delete_expired_transients()

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.

Tags
since
Return values
int

Number of transients that were cleared.

wc_get_relative_url()

Make a URL relative, if possible.

wc_get_relative_url( $url : string ) : string
Parameters
$url : string

URL to make relative.

Tags
since
Return values
string

wc_is_external_resource()

See if a resource is remote.

wc_is_external_resource( $url : string ) : bool
Parameters
$url : string

URL to check.

Tags
since
Return values
bool

wc_is_active_theme()

See if theme/s is activate or not.

wc_is_active_theme( $theme : string|array ) : bool
Parameters
$theme : string|array

Theme name or array of theme names to check.

Tags
since
Return values
bool

wc_is_wp_default_theme_active()

Is the site using a default WP theme?

wc_is_wp_default_theme_active( ) : bool
Return values
bool

wc_cleanup_session_data()

Cleans up session data - cron callback.

wc_cleanup_session_data( ) : mixed
Tags
since
Return values
mixed

wc_round_discount()

Round discount.

wc_round_discount( $value : float , $precision : int ) : float
Parameters
$value : float

Amount to round.

$precision : int

DP to round.

Return values
float

wc_selected()

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( $value : string|int , $options : string|int|array ) : string
Parameters
$value : string|int

Value to find within options.

$options : string|int|array

Options to go through when looking for value.

Return values
string

wc_get_server_database_version()

Retrieves the MySQL server version. Based on $wpdb.

wc_get_server_database_version( ) : array
Tags
since
Return values
array

Vesion information.

wc_load_cart()

Initialize and load the cart functionality.

wc_load_cart( ) : void
Tags
since

wc_is_running_from_async_action_scheduler()

Test whether the context of execution comes from async action scheduler.

wc_is_running_from_async_action_scheduler( ) : bool
Tags
since
Return values
bool

wc_do_deprecated_action()

Runs a deprecated action with notice only if used.

wc_do_deprecated_action( $tag : string , $args : array , $version : string [, $replacement : string = null ] [, $message : string = null ] ) : mixed
Parameters
$tag : string

The name of the action hook.

$args : array

Array of additional function arguments to be passed to do_action().

$version : string

The version of WooCommerce that deprecated the hook.

$replacement : string = null

The hook that should have been used.

$message : string = null

A message regarding the change.

Tags
since
Return values
mixed

wc_deprecated_function()

Wrapper for deprecated functions so we can apply some extra logic.

wc_deprecated_function( $function : string , $version : string [, $replacement : string = null ] ) : mixed
Parameters
$function : string

Function used.

$version : string

Version the message was added in.

$replacement : string = null

Replacement for the called function.

Tags
since
Return values
mixed

wc_deprecated_hook()

Wrapper for deprecated hook so we can apply some extra logic.

wc_deprecated_hook( $hook : string , $version : string [, $replacement : string = null ] [, $message : string = null ] ) : mixed
Parameters
$hook : string

The hook that was used.

$version : string

The version of WordPress that deprecated the hook.

$replacement : string = null

The hook that should have been used.

$message : string = null

A message regarding the change.

Tags
since
Return values
mixed

wc_caught_exception()

When catching an exception, this allows us to log it if unexpected.

wc_caught_exception( $exception_object : Exception [, $function : string = '' ] [, $args : array = array() ] ) : mixed
Parameters
$exception_object : Exception

The exception object.

$function : string = ''

The function which threw exception.

$args : array = array()

The args passed to the function.

Tags
since
Return values
mixed

wc_doing_it_wrong()

Wrapper for _doing_it_wrong().

wc_doing_it_wrong( $function : string , $message : string , $version : string ) : mixed
Parameters
$function : string

Function used.

$message : string

Message to log.

$version : string

Version the message was added in.

Tags
since
Return values
mixed

wc_deprecated_argument()

Wrapper for deprecated arguments so we can apply some extra logic.

wc_deprecated_argument( $argument : string , $version : string [, $message : mixed = null ] ) : mixed
Parameters
$argument : string
$version : string
$message : mixed = null
Tags
since
Return values
mixed

woocommerce_show_messages()

woocommerce_show_messages( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_weekend_area_js()

woocommerce_weekend_area_js( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_datepicker_js()

woocommerce_datepicker_js( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_admin_scripts()

woocommerce_admin_scripts( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_create_page()

woocommerce_create_page( $slug : mixed [, $option : mixed = '' ] [, $page_title : mixed = '' ] [, $page_content : mixed = '' ] , $post_parent : mixed ) : mixed
Parameters
$slug : mixed
$option : mixed = ''
$page_title : mixed = ''
$page_content : mixed = ''
$post_parent : mixed
Tags
deprecated
Return values
mixed

woocommerce_readfile_chunked()

woocommerce_readfile_chunked( $file : mixed [, $retbytes : mixed = true ] ) : mixed
Parameters
$file : mixed
$retbytes : mixed = true
Tags
deprecated
Return values
mixed

woocommerce_format_total()

Formal total costs - format to the number of decimal places for the base currency.

woocommerce_format_total( $number : mixed ) : string
Parameters
$number : mixed
Tags
access

public

deprecated
Return values
string

woocommerce_get_formatted_product_name()

Get product name with extra details such as SKU price and attributes. Used within admin.

woocommerce_get_formatted_product_name( $product : WC_Product ) : string
Parameters
$product : WC_Product
Tags
access

public

deprecated
Return values
string

woocommerce_legacy_paypal_ipn()

Handle IPN requests for the legacy paypal gateway by calling gateways manually if needed.

woocommerce_legacy_paypal_ipn( ) : mixed
Tags
access

public

Return values
mixed

get_product()

get_product( [ $the_product : mixed = false ] [, $args : mixed = array() ] ) : mixed
Parameters
$the_product : mixed = false
$args : mixed = array()
Tags
deprecated
Return values
mixed

woocommerce_protected_product_add_to_cart()

woocommerce_protected_product_add_to_cart( $passed : mixed , $product_id : mixed ) : mixed
Parameters
$passed : mixed
$product_id : mixed
Tags
deprecated
Return values
mixed

woocommerce_load_persistent_cart()

woocommerce_load_persistent_cart( $user_login : mixed , $user : mixed ) : mixed
Parameters
$user_login : mixed
$user : mixed
Tags
deprecated
Return values
mixed

woocommerce_add_to_cart_message()

woocommerce_add_to_cart_message( $product_id : mixed ) : mixed
Parameters
$product_id : mixed
Tags
deprecated
Return values
mixed

woocommerce_clear_cart_after_payment()

woocommerce_clear_cart_after_payment( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_cart_totals_subtotal_html()

woocommerce_cart_totals_subtotal_html( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_cart_totals_shipping_html()

woocommerce_cart_totals_shipping_html( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_cart_totals_coupon_html()

woocommerce_cart_totals_coupon_html( $coupon : mixed ) : mixed
Parameters
$coupon : mixed
Tags
deprecated
Return values
mixed

woocommerce_cart_totals_order_total_html()

woocommerce_cart_totals_order_total_html( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_cart_totals_fee_html()

woocommerce_cart_totals_fee_html( $fee : mixed ) : mixed
Parameters
$fee : mixed
Tags
deprecated
Return values
mixed

woocommerce_cart_totals_shipping_method_label()

woocommerce_cart_totals_shipping_method_label( $method : mixed ) : mixed
Parameters
$method : mixed
Tags
deprecated
Return values
mixed

woocommerce_get_template_part()

woocommerce_get_template_part( $slug : mixed [, $name : mixed = '' ] ) : mixed
Parameters
$slug : mixed
$name : mixed = ''
Tags
deprecated
Return values
mixed

woocommerce_get_template()

woocommerce_get_template( $template_name : mixed [, $args : mixed = array() ] [, $template_path : mixed = '' ] [, $default_path : mixed = '' ] ) : mixed
Parameters
$template_name : mixed
$args : mixed = array()
$template_path : mixed = ''
$default_path : mixed = ''
Tags
deprecated
Return values
mixed

woocommerce_locate_template()

woocommerce_locate_template( $template_name : mixed [, $template_path : mixed = '' ] [, $default_path : mixed = '' ] ) : mixed
Parameters
$template_name : mixed
$template_path : mixed = ''
$default_path : mixed = ''
Tags
deprecated
Return values
mixed

woocommerce_mail()

woocommerce_mail( $to : mixed , $subject : mixed , $message : mixed [, $headers : mixed = "Content-Type: text/html\r\n" ] [, $attachments : mixed = "" ] ) : mixed
Parameters
$to : mixed
$subject : mixed
$message : mixed
$headers : mixed = "Content-Type: text/html\r\n"
$attachments : mixed = ""
Tags
deprecated
Return values
mixed

woocommerce_disable_admin_bar()

woocommerce_disable_admin_bar( $show_admin_bar : mixed ) : mixed
Parameters
$show_admin_bar : mixed
Tags
deprecated
Return values
mixed

woocommerce_create_new_customer()

woocommerce_create_new_customer( $email : mixed [, $username : mixed = '' ] [, $password : mixed = '' ] ) : mixed
Parameters
$email : mixed
$username : mixed = ''
$password : mixed = ''
Tags
deprecated
Return values
mixed

woocommerce_set_customer_auth_cookie()

woocommerce_set_customer_auth_cookie( $customer_id : mixed ) : mixed
Parameters
$customer_id : mixed
Tags
deprecated
Return values
mixed

woocommerce_update_new_customer_past_orders()

woocommerce_update_new_customer_past_orders( $customer_id : mixed ) : mixed
Parameters
$customer_id : mixed
Tags
deprecated
Return values
mixed

woocommerce_paying_customer()

woocommerce_paying_customer( $order_id : mixed ) : mixed
Parameters
$order_id : mixed
Tags
deprecated
Return values
mixed

woocommerce_customer_bought_product()

woocommerce_customer_bought_product( $customer_email : mixed , $user_id : mixed , $product_id : mixed ) : mixed
Parameters
$customer_email : mixed
$user_id : mixed
$product_id : mixed
Tags
deprecated
Return values
mixed

woocommerce_customer_has_capability()

woocommerce_customer_has_capability( $allcaps : mixed , $caps : mixed , $args : mixed ) : mixed
Parameters
$allcaps : mixed
$caps : mixed
$args : mixed
Tags
deprecated
Return values
mixed

woocommerce_sanitize_taxonomy_name()

woocommerce_sanitize_taxonomy_name( $taxonomy : mixed ) : mixed
Parameters
$taxonomy : mixed
Tags
deprecated
Return values
mixed

woocommerce_get_filename_from_url()

woocommerce_get_filename_from_url( $file_url : mixed ) : mixed
Parameters
$file_url : mixed
Tags
deprecated
Return values
mixed

woocommerce_get_dimension()

woocommerce_get_dimension( $dim : mixed , $to_unit : mixed ) : mixed
Parameters
$dim : mixed
$to_unit : mixed
Tags
deprecated
Return values
mixed

woocommerce_get_weight()

woocommerce_get_weight( $weight : mixed , $to_unit : mixed ) : mixed
Parameters
$weight : mixed
$to_unit : mixed
Tags
deprecated
Return values
mixed

woocommerce_trim_zeros()

woocommerce_trim_zeros( $price : mixed ) : mixed
Parameters
$price : mixed
Tags
deprecated
Return values
mixed

woocommerce_round_tax_total()

woocommerce_round_tax_total( $tax : mixed ) : mixed
Parameters
$tax : mixed
Tags
deprecated
Return values
mixed

woocommerce_format_decimal()

woocommerce_format_decimal( $number : mixed [, $dp : mixed = false ] [, $trim_zeros : mixed = false ] ) : mixed
Parameters
$number : mixed
$dp : mixed = false
$trim_zeros : mixed = false
Tags
deprecated
Return values
mixed

woocommerce_clean()

woocommerce_clean( $var : mixed ) : mixed
Parameters
$var : mixed
Tags
deprecated
Return values
mixed

woocommerce_array_overlay()

woocommerce_array_overlay( $a1 : mixed , $a2 : mixed ) : mixed
Parameters
$a1 : mixed
$a2 : mixed
Tags
deprecated
Return values
mixed

woocommerce_price()

woocommerce_price( $price : mixed [, $args : mixed = array() ] ) : mixed
Parameters
$price : mixed
$args : mixed = array()
Tags
deprecated
Return values
mixed

woocommerce_let_to_num()

woocommerce_let_to_num( $size : mixed ) : mixed
Parameters
$size : mixed
Tags
deprecated
Return values
mixed

woocommerce_timezone_string()

woocommerce_timezone_string( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_rgb_from_hex()

woocommerce_rgb_from_hex( $color : mixed ) : mixed
Parameters
$color : mixed
Tags
deprecated
Return values
mixed

woocommerce_hex_darker()

woocommerce_hex_darker( $color : mixed [, $factor : mixed = 30 ] ) : mixed
Parameters
$color : mixed
$factor : mixed = 30
Tags
deprecated
Return values
mixed

woocommerce_hex_lighter()

woocommerce_hex_lighter( $color : mixed [, $factor : mixed = 30 ] ) : mixed
Parameters
$color : mixed
$factor : mixed = 30
Tags
deprecated
Return values
mixed

woocommerce_light_or_dark()

woocommerce_light_or_dark( $color : mixed [, $dark : mixed = '#000000' ] [, $light : mixed = '#FFFFFF' ] ) : mixed
Parameters
$color : mixed
$dark : mixed = '#000000'
$light : mixed = '#FFFFFF'
Tags
deprecated
Return values
mixed

woocommerce_format_hex()

woocommerce_format_hex( $hex : mixed ) : mixed
Parameters
$hex : mixed
Tags
deprecated
Return values
mixed

woocommerce_get_order_id_by_order_key()

woocommerce_get_order_id_by_order_key( $order_key : mixed ) : mixed
Parameters
$order_key : mixed
Tags
deprecated
Return values
mixed

woocommerce_downloadable_file_permission()

woocommerce_downloadable_file_permission( $download_id : mixed , $product_id : mixed , $order : mixed ) : mixed
Parameters
$download_id : mixed
$product_id : mixed
$order : mixed
Tags
deprecated
Return values
mixed

woocommerce_downloadable_product_permissions()

woocommerce_downloadable_product_permissions( $order_id : mixed ) : mixed
Parameters
$order_id : mixed
Tags
deprecated
Return values
mixed

woocommerce_add_order_item()

woocommerce_add_order_item( $order_id : mixed , $item : mixed ) : mixed
Parameters
$order_id : mixed
$item : mixed
Tags
deprecated
Return values
mixed

woocommerce_delete_order_item()

woocommerce_delete_order_item( $item_id : mixed ) : mixed
Parameters
$item_id : mixed
Tags
deprecated
Return values
mixed

woocommerce_update_order_item_meta()

woocommerce_update_order_item_meta( $item_id : mixed , $meta_key : mixed , $meta_value : mixed [, $prev_value : mixed = '' ] ) : mixed
Parameters
$item_id : mixed
$meta_key : mixed
$meta_value : mixed
$prev_value : mixed = ''
Tags
deprecated
Return values
mixed

woocommerce_add_order_item_meta()

woocommerce_add_order_item_meta( $item_id : mixed , $meta_key : mixed , $meta_value : mixed [, $unique : mixed = false ] ) : mixed
Parameters
$item_id : mixed
$meta_key : mixed
$meta_value : mixed
$unique : mixed = false
Tags
deprecated
Return values
mixed

woocommerce_delete_order_item_meta()

woocommerce_delete_order_item_meta( $item_id : mixed , $meta_key : mixed [, $meta_value : mixed = '' ] [, $delete_all : mixed = false ] ) : mixed
Parameters
$item_id : mixed
$meta_key : mixed
$meta_value : mixed = ''
$delete_all : mixed = false
Tags
deprecated
Return values
mixed

woocommerce_get_order_item_meta()

woocommerce_get_order_item_meta( $item_id : mixed , $key : mixed [, $single : mixed = true ] ) : mixed
Parameters
$item_id : mixed
$key : mixed
$single : mixed = true
Tags
deprecated
Return values
mixed

woocommerce_cancel_unpaid_orders()

woocommerce_cancel_unpaid_orders( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_processing_order_count()

woocommerce_processing_order_count( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_get_page_id()

woocommerce_get_page_id( $page : mixed ) : mixed
Parameters
$page : mixed
Tags
deprecated
Return values
mixed

woocommerce_get_endpoint_url()

woocommerce_get_endpoint_url( $endpoint : mixed [, $value : mixed = '' ] [, $permalink : mixed = '' ] ) : mixed
Parameters
$endpoint : mixed
$value : mixed = ''
$permalink : mixed = ''
Tags
deprecated
Return values
mixed

woocommerce_lostpassword_url()

woocommerce_lostpassword_url( $url : mixed ) : mixed
Parameters
$url : mixed
Tags
deprecated
Return values
mixed

woocommerce_customer_edit_account_url()

woocommerce_customer_edit_account_url( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_nav_menu_items()

woocommerce_nav_menu_items( $items : mixed , $args : mixed ) : mixed
Parameters
$items : mixed
$args : mixed
Tags
deprecated
Return values
mixed

woocommerce_nav_menu_item_classes()

woocommerce_nav_menu_item_classes( $menu_items : mixed , $args : mixed ) : mixed
Parameters
$menu_items : mixed
$args : mixed
Tags
deprecated
Return values
mixed

woocommerce_list_pages()

woocommerce_list_pages( $pages : mixed ) : mixed
Parameters
$pages : mixed
Tags
deprecated
Return values
mixed

woocommerce_product_dropdown_categories()

woocommerce_product_dropdown_categories( [ $args : mixed = array() ] [, $deprecated_hierarchical : mixed = 1 ] [, $deprecated_show_uncategorized : mixed = 1 ] [, $deprecated_orderby : mixed = '' ] ) : mixed
Parameters
$args : mixed = array()
$deprecated_hierarchical : mixed = 1
$deprecated_show_uncategorized : mixed = 1
$deprecated_orderby : mixed = ''
Tags
deprecated
Return values
mixed

woocommerce_walk_category_dropdown_tree()

woocommerce_walk_category_dropdown_tree( [ $a1 : mixed = '' ] [, $a2 : mixed = '' ] [, $a3 : mixed = '' ] ) : mixed
Parameters
$a1 : mixed = ''
$a2 : mixed = ''
$a3 : mixed = ''
Tags
deprecated
Return values
mixed

woocommerce_taxonomy_metadata_wpdbfix()

woocommerce_taxonomy_metadata_wpdbfix( ) : mixed
Tags
deprecated
Return values
mixed

wc_taxonomy_metadata_wpdbfix()

wc_taxonomy_metadata_wpdbfix( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_order_terms()

woocommerce_order_terms( $the_term : mixed , $next_id : mixed , $taxonomy : mixed , $index : mixed [, $terms : mixed = null ] ) : mixed
Parameters
$the_term : mixed
$next_id : mixed
$taxonomy : mixed
$index : mixed
$terms : mixed = null
Tags
deprecated
Return values
mixed

woocommerce_set_term_order()

woocommerce_set_term_order( $term_id : mixed , $index : mixed , $taxonomy : mixed [, $recursive : mixed = false ] ) : mixed
Parameters
$term_id : mixed
$index : mixed
$taxonomy : mixed
$recursive : mixed = false
Tags
deprecated
Return values
mixed

woocommerce_terms_clauses()

woocommerce_terms_clauses( $clauses : mixed , $taxonomies : mixed , $args : mixed ) : mixed
Parameters
$clauses : mixed
$taxonomies : mixed
$args : mixed
Tags
deprecated
Return values
mixed

_woocommerce_term_recount()

_woocommerce_term_recount( $terms : mixed , $taxonomy : mixed , $callback : mixed , $terms_are_term_taxonomy_ids : mixed ) : mixed
Parameters
$terms : mixed
$taxonomy : mixed
$callback : mixed
$terms_are_term_taxonomy_ids : mixed
Tags
deprecated
Return values
mixed

woocommerce_recount_after_stock_change()

woocommerce_recount_after_stock_change( $product_id : mixed ) : mixed
Parameters
$product_id : mixed
Tags
deprecated
Return values
mixed

woocommerce_change_term_counts()

woocommerce_change_term_counts( $terms : mixed , $taxonomies : mixed , $args : mixed ) : mixed
Parameters
$terms : mixed
$taxonomies : mixed
$args : mixed
Tags
deprecated
Return values
mixed

woocommerce_get_product_ids_on_sale()

woocommerce_get_product_ids_on_sale( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_get_featured_product_ids()

woocommerce_get_featured_product_ids( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_get_product_terms()

woocommerce_get_product_terms( $object_id : mixed , $taxonomy : mixed [, $fields : mixed = 'all' ] ) : mixed
Parameters
$object_id : mixed
$taxonomy : mixed
$fields : mixed = 'all'
Tags
deprecated
Return values
mixed

woocommerce_product_post_type_link()

woocommerce_product_post_type_link( $permalink : mixed , $post : mixed ) : mixed
Parameters
$permalink : mixed
$post : mixed
Tags
deprecated
Return values
mixed

woocommerce_placeholder_img_src()

woocommerce_placeholder_img_src( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_placeholder_img()

woocommerce_placeholder_img( [ $size : mixed = 'woocommerce_thumbnail' ] ) : mixed
Parameters
$size : mixed = 'woocommerce_thumbnail'
Tags
deprecated
Return values
mixed

woocommerce_get_formatted_variation()

woocommerce_get_formatted_variation( [ $variation : mixed = '' ] [, $flat : mixed = false ] ) : mixed
Parameters
$variation : mixed = ''
$flat : mixed = false
Tags
deprecated
Return values
mixed

woocommerce_scheduled_sales()

woocommerce_scheduled_sales( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_get_attachment_image_attributes()

woocommerce_get_attachment_image_attributes( $attr : mixed ) : mixed
Parameters
$attr : mixed
Tags
deprecated
Return values
mixed

woocommerce_prepare_attachment_for_js()

woocommerce_prepare_attachment_for_js( $response : mixed ) : mixed
Parameters
$response : mixed
Tags
deprecated
Return values
mixed

woocommerce_track_product_view()

woocommerce_track_product_view( ) : mixed
Tags
deprecated
Return values
mixed

woocommerce_compile_less_styles()

woocommerce_compile_less_styles( ) : mixed
Tags
deprecated

has no replacement

Return values
mixed

woocommerce_calc_shipping_backwards_compatibility()

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( $value : mixed ) : string
Parameters
$value : mixed
Tags
deprecated
Return values
string

woocommerce_get_product_schema()

woocommerce_get_product_schema( ) : string
Tags
deprecated
see

class

Return values
string

_wc_save_product_price()

Save product price.

_wc_save_product_price( $product_id : int , $regular_price : float [, $sale_price : float = '' ] [, $date_from : string = '' ] [, $date_to : string = '' ] ) : mixed

This is a private function (internal use ONLY) used until a data manipulation api is built.

Parameters
$product_id : int
$regular_price : float
$sale_price : float = ''
$date_from : string = ''
$date_to : string = ''
Tags
deprecated
Return values
mixed

wc_get_customer_avatar_url()

Return customer avatar URL.

wc_get_customer_avatar_url( $email : string ) : string
Parameters
$email : string

the customer's email.

Tags
deprecated
since
Return values
string

the URL to the customer's avatar.

wc_get_core_supported_themes()

WooCommerce Core Supported Themes.

wc_get_core_supported_themes( ) : string[]
Tags
deprecated
since
Return values
string[]

wc_get_min_max_price_meta_query()

Get min/max price meta query args.

wc_get_min_max_price_meta_query( $args : array ) : array
Parameters
$args : array

Min price and max price arguments.

Tags
deprecated
since
Return values
array

wc_taxonomy_metadata_update_content_for_split_terms()

When a term is split, ensure meta data maintained.

wc_taxonomy_metadata_update_content_for_split_terms( $old_term_id : int , $new_term_id : int , $term_taxonomy_id : string , $taxonomy : string ) : mixed
Parameters
$old_term_id : int

Old term ID.

$new_term_id : int

New term ID.

$term_taxonomy_id : string

Term taxonomy ID.

$taxonomy : string

Taxonomy.

Tags
deprecated
Return values
mixed

update_woocommerce_term_meta()

WooCommerce Term Meta API.

update_woocommerce_term_meta( $term_id : int , $meta_key : string , $meta_value : mixed [, $prev_value : string = '' ] ) : 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.

Parameters
$term_id : int

Term ID.

$meta_key : string

Meta key.

$meta_value : mixed

Meta value.

$prev_value : string = ''

Previous value. (default: '').

Tags
deprecated
Return values
bool

add_woocommerce_term_meta()

WooCommerce Term Meta API.

add_woocommerce_term_meta( $term_id : int , $meta_key : string , $meta_value : mixed [, $unique : bool = 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.

Parameters
$term_id : int

Term ID.

$meta_key : string

Meta key.

$meta_value : mixed

Meta value.

$unique : bool = false

Make meta key unique. (default: false).

Tags
deprecated
Return values
bool

delete_woocommerce_term_meta()

WooCommerce Term Meta API

delete_woocommerce_term_meta( $term_id : int , $meta_key : string [, $meta_value : string = '' ] [, $deprecated : bool = 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.

Parameters
$term_id : int

Term ID.

$meta_key : string

Meta key.

$meta_value : string = ''

Meta value (default: '').

$deprecated : bool = false

Deprecated param (default: false).

Tags
deprecated
Return values
bool

get_woocommerce_term_meta()

WooCommerce Term Meta API

get_woocommerce_term_meta( $term_id : int , $key : string [, $single : bool = 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.

Parameters
$term_id : int

Term ID.

$key : string

Meta key.

$single : bool = true

Whether to return a single value. (default: true).

Tags
deprecated
Return values
mixed

wc_page_endpoint_title()

Replace a page title with the endpoint title.

wc_page_endpoint_title( $title : string ) : string
Parameters
$title : string

Post title.

Return values
string

wc_get_page_id()

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( $page : string ) : int
Parameters
$page : string

Page slug.

Return values
int

wc_get_page_permalink()

Retrieve page permalink.

wc_get_page_permalink( $page : string [, $fallback : string|bool = null ] ) : string
Parameters
$page : string

page slug.

$fallback : string|bool = null

Fallback URL if page is not set. Defaults to home URL. @since 3.4.0.

Return values
string

wc_get_endpoint_url()

Get endpoint URL.

wc_get_endpoint_url( $endpoint : string [, $value : string = '' ] [, $permalink : string = '' ] ) : string

Gets the URL for an endpoint, which varies depending on permalink settings.

Parameters
$endpoint : string

Endpoint slug.

$value : string = ''

Query param value.

$permalink : string = ''

Permalink.

Return values
string

wc_nav_menu_items()

Hide menu items conditionally.

wc_nav_menu_items( $items : array ) : array
Parameters
$items : array

Navigation items.

Return values
array

wc_nav_menu_item_classes()

Fix active class in nav for shop page.

wc_nav_menu_item_classes( $menu_items : array ) : array
Parameters
$menu_items : array

Menu items.

Return values
array

wc_template_redirect()

Handle redirects before content is output - hooked into template_redirect so is_page works.

wc_template_redirect( ) : mixed
Return values
mixed

wc_send_frame_options_header()

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' );

Tags
since
Return values
mixed

wc_prevent_endpoint_indexing()

No index our endpoints.

wc_prevent_endpoint_indexing( ) : mixed

Prevent indexing pages like order-received.

Tags
since
Return values
mixed

wc_prevent_adjacent_posts_rel_link_wp_head()

Remove adjacent_posts_rel_link_wp_head - pointless for products.

wc_prevent_adjacent_posts_rel_link_wp_head( ) : mixed
Tags
since
Return values
mixed

wc_gallery_noscript()

Show the gallery if JS is disabled.

wc_gallery_noscript( ) : mixed
Tags
since
Return values
mixed

wc_setup_product_data()

When the_post is called, put product data into a global.

wc_setup_product_data( $post : mixed ) : WC_Product
Parameters
$post : mixed

Post Object.

Return values
WC_Product

wc_setup_loop()

Sets up the woocommerce_loop global from the passed args or from the main query.

wc_setup_loop( [ $args : array = array() ] ) : mixed
Parameters
$args : array = array()

Args to pass into the global.

Tags
since
Return values
mixed

wc_reset_loop()

Resets the woocommerce_loop global.

wc_reset_loop( ) : mixed
Tags
since
Return values
mixed

wc_get_loop_prop()

Gets a property from the woocommerce_loop global.

wc_get_loop_prop( $prop : string [, $default : string = '' ] ) : mixed
Parameters
$prop : string

Prop to get.

$default : string = ''

Default if the prop does not exist.

Tags
since
Return values
mixed

wc_set_loop_prop()

Sets a property in the woocommerce_loop global.

wc_set_loop_prop( $prop : string [, $value : string = '' ] ) : mixed
Parameters
$prop : string

Prop to set.

$value : string = ''

Value to set.

Tags
since
Return values
mixed

wc_set_loop_product_visibility()

Set the current visbility for a product in the woocommerce_loop global.

wc_set_loop_product_visibility( $product_id : int , $value : bool ) : mixed
Parameters
$product_id : int

Product it to cache visbiility for.

$value : bool

The poduct visibility value to cache.

Tags
since
Return values
mixed

wc_get_loop_product_visibility()

Gets the cached current visibility for a product from the woocommerce_loop global.

wc_get_loop_product_visibility( $product_id : int ) : bool|null
Parameters
$product_id : int

Product id to get the cached visibility for.

Tags
since
Return values
bool|null

The cached product visibility, or null if on visibility has been cached for that product.

woocommerce_product_loop()

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.

Tags
since
Return values
bool

wc_generator_tag()

Output generator tag to aid debugging.

wc_generator_tag( $gen : string , $type : string ) : string
Parameters
$gen : string

Generator.

$type : string

Type.

Return values
string

wc_body_class()

Add body classes for WC pages.

wc_body_class( $classes : array ) : array
Parameters
$classes : array

Body Classes.

Return values
array

wc_product_cat_class()

Display the classes for the product cat div.

wc_product_cat_class( [ $class : string|array = '' ] [, $category : object = null ] ) : mixed
Parameters
$class : string|array = ''

One or more classes to add to the class list.

$category : object = null

object Optional.

Tags
since
Return values
mixed

wc_get_default_products_per_row()

Get the default columns setting - this is how many products will be shown per row in loops.

wc_get_default_products_per_row( ) : int
Tags
since
Return values
int

wc_get_default_product_rows_per_page()

Get the default rows setting - this is how many product rows will be shown in loops.

wc_get_default_product_rows_per_page( ) : int
Tags
since
Return values
int

wc_reset_product_grid_settings()

Reset the product grid settings when a new theme is activated.

wc_reset_product_grid_settings( ) : mixed
Tags
since
Return values
mixed

wc_get_loop_class()

Get classname for woocommerce loops.

wc_get_loop_class( ) : string
Tags
since
Return values
string

wc_get_product_cat_class()

Get the classes for the product cat div.

wc_get_product_cat_class( [ $class : string|array = '' ] [, $category : object = null ] ) : array
Parameters
$class : string|array = ''

One or more classes to add to the class list.

$category : object = null

object Optional.

Tags
since
Return values
array

wc_product_post_class()

Adds extra post classes for products via the WordPress post_class hook, if used.

wc_product_post_class( $classes : array [, $class : string|array = '' ] , $post_id : int ) : array

Note: For performance reasons we instead recommend using wc_product_class/wc_get_product_class instead.

Parameters
$classes : array

Current classes.

$class : string|array = ''

Additional class.

$post_id : int

Post ID.

Tags
since
Return values
array

wc_get_product_taxonomy_class()

Get product taxonomy HTML classes.

wc_get_product_taxonomy_class( $term_ids : array , $taxonomy : string ) : array
Parameters
$term_ids : array

Array of terms IDs or objects.

$taxonomy : string

Taxonomy.

Tags
since
Return values
array

wc_get_product_class()

Retrieves the classes for the post div as an array.

wc_get_product_class( [ $class : string|array = '' ] [, $product : int|WP_Post|WC_Product = null ] ) : array

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

Parameters
$class : string|array = ''

One or more classes to add to the class list.

$product : int|WP_Post|WC_Product = null

Product ID or product object.

Tags
since
Return values
array

wc_product_class()

Display the classes for the product div.

wc_product_class( [ $class : string|array = '' ] [, $product_id : int|WP_Post|WC_Product = null ] ) : mixed
Parameters
$class : string|array = ''

One or more classes to add to the class list.

$product_id : int|WP_Post|WC_Product = null

Product ID or product object.

Tags
since
Return values
mixed

wc_query_string_form_fields()

Outputs hidden form inputs for each query string variable.

wc_query_string_form_fields( [ $values : string|array = null ] [, $exclude : array = array() ] [, $current_key : string = '' ] [, $return : bool = false ] ) : string
Parameters
$values : string|array = null

Name value pairs, or a URL to parse.

$exclude : array = array()

Keys to exclude.

$current_key : string = ''

Current key we are outputting.

$return : bool = false

Whether to return.

Tags
since
Return values
string

wc_terms_and_conditions_page_id()

Get the terms and conditons page ID.

wc_terms_and_conditions_page_id( ) : int
Tags
since
Return values
int

wc_privacy_policy_page_id()

Get the privacy policy page ID.

wc_privacy_policy_page_id( ) : int
Tags
since
Return values
int

wc_terms_and_conditions_checkbox_enabled()

See if the checkbox is enabled or not based on the existance of the terms page and checkbox text.

wc_terms_and_conditions_checkbox_enabled( ) : bool
Tags
since
Return values
bool

wc_get_terms_and_conditions_checkbox_text()

Get the terms and conditons checkbox text, if set.

wc_get_terms_and_conditions_checkbox_text( ) : string
Tags
since
Return values
string

wc_get_privacy_policy_text()

Get the privacy policy text, if set.

wc_get_privacy_policy_text( [ $type : string = '' ] ) : string
Parameters
$type : string = ''

Type of policy to load. Valid values include registration and checkout.

Tags
since
Return values
string

wc_terms_and_conditions_checkbox_text()

Output t&c checkbox text.

wc_terms_and_conditions_checkbox_text( ) : mixed
Tags
since
Return values
mixed

wc_terms_and_conditions_page_content()

Output t&c page's content (if set). The page can be set from checkout settings.

wc_terms_and_conditions_page_content( ) : mixed
Tags
since
Return values
mixed

wc_checkout_privacy_policy_text()

Render privacy policy text on the checkout.

wc_checkout_privacy_policy_text( ) : mixed
Tags
since
Return values
mixed

wc_registration_privacy_policy_text()

Render privacy policy text on the register forms.

wc_registration_privacy_policy_text( ) : mixed
Tags
since
Return values
mixed

wc_privacy_policy_text()

Output privacy policy text. This is custom text which can be added via the customizer/privacy settings section.

wc_privacy_policy_text( [ $type : string = 'checkout' ] ) : mixed

Loads the relevant policy for the current page unless a specific policy text is required.

Parameters
$type : string = 'checkout'

Type of policy to load. Valid values include registration and checkout.

Tags
since
Return values
mixed

wc_replace_policy_page_link_placeholders()

Replaces placeholders with links to WooCommerce policy pages.

wc_replace_policy_page_link_placeholders( $text : string ) : string
Parameters
$text : string

Text to find/replace within.

Tags
since
Return values
string

woocommerce_content()

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.

Return values
mixed

woocommerce_output_content_wrapper()

Output the start of the page wrapper.

woocommerce_output_content_wrapper( ) : mixed
Return values
mixed

woocommerce_output_content_wrapper_end()

Output the end of the page wrapper.

woocommerce_output_content_wrapper_end( ) : mixed
Return values
mixed

woocommerce_get_sidebar()

Get the shop sidebar template.

woocommerce_get_sidebar( ) : mixed
Return values
mixed

woocommerce_demo_store()

Adds a demo store banner to the site if enabled.

woocommerce_demo_store( ) : mixed
Return values
mixed

woocommerce_page_title()

Page Title function.

woocommerce_page_title( [ $echo : bool = true ] ) : string
Parameters
$echo : bool = true

Should echo title.

Return values
string

woocommerce_product_loop_start()

Output the start of a product loop. By default this is a UL.

woocommerce_product_loop_start( [ $echo : bool = true ] ) : string
Parameters
$echo : bool = true

Should echo?.

Return values
string

woocommerce_product_loop_end()

Output the end of a product loop. By default this is a UL.

woocommerce_product_loop_end( [ $echo : bool = true ] ) : string
Parameters
$echo : bool = true

Should echo?.

Return values
string

woocommerce_template_loop_product_title()

Show the product title in the product loop. By default this is an H2.

woocommerce_template_loop_product_title( ) : mixed
Return values
mixed

woocommerce_template_loop_category_title()

Show the subcategory title in the product loop.

woocommerce_template_loop_category_title( $category : object ) : mixed
Parameters
$category : object

Category object.

Return values
mixed

woocommerce_template_loop_product_link_open()

Insert the opening anchor tag for products in the loop.

woocommerce_template_loop_product_link_open( ) : mixed
Return values
mixed

woocommerce_template_loop_product_link_close()

Insert the closing anchor tag for products in the loop.

woocommerce_template_loop_product_link_close( ) : mixed
Return values
mixed

woocommerce_template_loop_category_link_open()

Insert the opening anchor tag for categories in the loop.

woocommerce_template_loop_category_link_open( $category : int|object|string ) : mixed
Parameters
$category : int|object|string

Category ID, Object or String.

Return values
mixed

woocommerce_template_loop_category_link_close()

Insert the closing anchor tag for categories in the loop.

woocommerce_template_loop_category_link_close( ) : mixed
Return values
mixed

woocommerce_taxonomy_archive_description()

Show an archive description on taxonomy archives.

woocommerce_taxonomy_archive_description( ) : mixed
Return values
mixed

woocommerce_product_archive_description()

Show a shop page description on product archives.

woocommerce_product_archive_description( ) : mixed
Return values
mixed

woocommerce_template_loop_add_to_cart()

Get the add to cart template for the loop.

woocommerce_template_loop_add_to_cart( [ $args : array = array() ] ) : mixed
Parameters
$args : array = array()

Arguments.

Return values
mixed

woocommerce_template_loop_product_thumbnail()

Get the product thumbnail for the loop.

woocommerce_template_loop_product_thumbnail( ) : mixed
Return values
mixed

woocommerce_template_loop_price()

Get the product price for the loop.

woocommerce_template_loop_price( ) : mixed
Return values
mixed

woocommerce_template_loop_rating()

Display the average rating in the loop.

woocommerce_template_loop_rating( ) : mixed
Return values
mixed

woocommerce_show_product_loop_sale_flash()

Get the sale flash for the loop.

woocommerce_show_product_loop_sale_flash( ) : mixed
Return values
mixed

woocommerce_get_product_thumbnail()

Get the product thumbnail, or the placeholder if not set.

woocommerce_get_product_thumbnail( [ $size : string = 'woocommerce_thumbnail' ] , $deprecated1 : int , $deprecated2 : int ) : string
Parameters
$size : string = 'woocommerce_thumbnail'

(default: 'woocommerce_thumbnail').

$deprecated1 : int

Deprecated since WooCommerce 2.0 (default: 0).

$deprecated2 : int

Deprecated since WooCommerce 2.0 (default: 0).

Return values
string

woocommerce_result_count()

Output the result count text (Showing x - x of x results).

woocommerce_result_count( ) : mixed
Return values
mixed

woocommerce_catalog_ordering()

Output the product sorting options.

woocommerce_catalog_ordering( ) : mixed
Return values
mixed

woocommerce_pagination()

Output the pagination.

woocommerce_pagination( ) : mixed
Return values
mixed

woocommerce_show_product_images()

Output the product image before the single product summary.

woocommerce_show_product_images( ) : mixed
Return values
mixed

woocommerce_show_product_thumbnails()

Output the product thumbnails.

woocommerce_show_product_thumbnails( ) : mixed
Return values
mixed

wc_get_gallery_image_html()

Get HTML for a gallery image.

wc_get_gallery_image_html( $attachment_id : int [, $main_image : bool = 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.

Parameters
$attachment_id : int

Attachment ID.

$main_image : bool = false

Is this the main image or a thumbnail?.

Tags
since
Return values
string

woocommerce_output_product_data_tabs()

Output the product tabs.

woocommerce_output_product_data_tabs( ) : mixed
Return values
mixed

woocommerce_template_single_title()

Output the product title.

woocommerce_template_single_title( ) : mixed
Return values
mixed

woocommerce_template_single_rating()

Output the product rating.

woocommerce_template_single_rating( ) : mixed
Return values
mixed

woocommerce_template_single_price()

Output the product price.

woocommerce_template_single_price( ) : mixed
Return values
mixed

woocommerce_template_single_excerpt()

Output the product short description (excerpt).

woocommerce_template_single_excerpt( ) : mixed
Return values
mixed

woocommerce_template_single_meta()

Output the product meta.

woocommerce_template_single_meta( ) : mixed
Return values
mixed

woocommerce_template_single_sharing()

Output the product sharing.

woocommerce_template_single_sharing( ) : mixed
Return values
mixed

woocommerce_show_product_sale_flash()

Output the product sale flash.

woocommerce_show_product_sale_flash( ) : mixed
Return values
mixed

woocommerce_template_single_add_to_cart()

Trigger the single product add to cart action.

woocommerce_template_single_add_to_cart( ) : mixed
Return values
mixed

woocommerce_simple_add_to_cart()

Output the simple product add to cart area.

woocommerce_simple_add_to_cart( ) : mixed
Return values
mixed

woocommerce_grouped_add_to_cart()

Output the grouped product add to cart area.

woocommerce_grouped_add_to_cart( ) : mixed
Return values
mixed

woocommerce_variable_add_to_cart()

Output the variable product add to cart area.

woocommerce_variable_add_to_cart( ) : mixed
Return values
mixed

woocommerce_external_add_to_cart()

Output the external product add to cart area.

woocommerce_external_add_to_cart( ) : mixed
Return values
mixed

woocommerce_quantity_input()

Output the quantity input for add to cart forms.

woocommerce_quantity_input( [ $args : array = array() ] [, $product : WC_Product|null = null ] [, $echo : bool = true ] ) : string
Parameters
$args : array = array()

Args for the input.

$product : WC_Product|null = null

Product.

$echo : bool = true

Whether to return or echo|string.

Return values
string

woocommerce_product_description_tab()

Output the description tab content.

woocommerce_product_description_tab( ) : mixed
Return values
mixed

woocommerce_product_additional_information_tab()

Output the attributes tab content.

woocommerce_product_additional_information_tab( ) : mixed
Return values
mixed

woocommerce_default_product_tabs()

Add default product tabs to product pages.

woocommerce_default_product_tabs( [ $tabs : array = array() ] ) : array
Parameters
$tabs : array = array()

Array of tabs.

Return values
array

woocommerce_sort_product_tabs()

Sort tabs by priority.

woocommerce_sort_product_tabs( [ $tabs : array = array() ] ) : array
Parameters
$tabs : array = array()

Array of tabs.

Return values
array

woocommerce_comments()

Output the Review comments template.

woocommerce_comments( $comment : WP_Comment , $args : array , $depth : int ) : mixed
Parameters
$comment : WP_Comment

Comment object.

$args : array

Arguments.

$depth : int

Depth.

Return values
mixed

woocommerce_review_display_gravatar()

Display the review authors gravatar

woocommerce_review_display_gravatar( $comment : array ) : void
Parameters
$comment : array

WP_Comment.

woocommerce_review_display_rating()

Display the reviewers star rating

woocommerce_review_display_rating( ) : void

woocommerce_review_display_meta()

Display the review authors meta (name, verified owner, review date)

woocommerce_review_display_meta( ) : void

woocommerce_review_display_comment_text()

Display the review content.

woocommerce_review_display_comment_text( ) : mixed
Return values
mixed

woocommerce_output_related_products()

Output the related products.

woocommerce_output_related_products( ) : mixed
Return values
mixed

woocommerce_related_products()

Output the related products.

woocommerce_related_products( [ $args : array = array() ] ) : mixed
Parameters
$args : array = array()

Provided arguments.

Return values
mixed

woocommerce_upsell_display()

Output product up sells.

woocommerce_upsell_display( [ $limit : int = '-1' ] [, $columns : int = 4 ] [, $orderby : string = 'rand' ] [, $order : string = 'desc' ] ) : mixed
Parameters
$limit : int = '-1'

(default: -1).

$columns : int = 4

(default: 4).

$orderby : string = 'rand'

Supported values - rand, title, ID, date, modified, menu_order, price.

$order : string = 'desc'

Sort direction.

Return values
mixed

woocommerce_shipping_calculator()

Output the cart shipping calculator.

woocommerce_shipping_calculator( [ $button_text : string = '' ] ) : mixed
Parameters
$button_text : string = ''

Text for the shipping calculation toggle.

Return values
mixed

woocommerce_cart_totals()

Output the cart totals.

woocommerce_cart_totals( ) : mixed
Return values
mixed

woocommerce_cross_sell_display()

Output the cart cross-sells.

woocommerce_cross_sell_display( [ $limit : int = 2 ] [, $columns : int = 2 ] [, $orderby : string = 'rand' ] [, $order : string = 'desc' ] ) : mixed
Parameters
$limit : int = 2

(default: 2).

$columns : int = 2

(default: 2).

$orderby : string = 'rand'

(default: 'rand').

$order : string = 'desc'

(default: 'desc').

Return values
mixed

woocommerce_button_proceed_to_checkout()

Output the proceed to checkout button.

woocommerce_button_proceed_to_checkout( ) : mixed
Return values
mixed

woocommerce_widget_shopping_cart_button_view_cart()

Output the view cart button.

woocommerce_widget_shopping_cart_button_view_cart( ) : mixed
Return values
mixed

woocommerce_widget_shopping_cart_proceed_to_checkout()

Output the proceed to checkout button.

woocommerce_widget_shopping_cart_proceed_to_checkout( ) : mixed
Return values
mixed

woocommerce_widget_shopping_cart_subtotal()

Output to view cart subtotal.

woocommerce_widget_shopping_cart_subtotal( ) : mixed
Tags
since
Return values
mixed

woocommerce_mini_cart()

Output the Mini-cart - used by cart widget.

woocommerce_mini_cart( [ $args : array = array() ] ) : mixed
Parameters
$args : array = array()

Arguments.

Return values
mixed

woocommerce_login_form()

Output the WooCommerce Login Form.

woocommerce_login_form( [ $args : array = array() ] ) : mixed
Parameters
$args : array = array()

Arguments.

Return values
mixed

woocommerce_checkout_login_form()

Output the WooCommerce Checkout Login Form.

woocommerce_checkout_login_form( ) : mixed
Return values
mixed

woocommerce_breadcrumb()

Output the WooCommerce Breadcrumb.

woocommerce_breadcrumb( [ $args : array = array() ] ) : mixed
Parameters
$args : array = array()

Arguments.

Return values
mixed

woocommerce_order_review()

Output the Order review table for the checkout.

woocommerce_order_review( [ $deprecated : bool = false ] ) : mixed
Parameters
$deprecated : bool = false

Deprecated param.

Return values
mixed

woocommerce_checkout_payment()

Output the Payment Methods on the checkout.

woocommerce_checkout_payment( ) : mixed
Return values
mixed

woocommerce_checkout_coupon_form()

Output the Coupon form for the checkout.

woocommerce_checkout_coupon_form( ) : mixed
Return values
mixed

woocommerce_products_will_display()

Check if we will be showing products or not (and not sub-categories only).

woocommerce_products_will_display( ) : bool
Return values
bool

woocommerce_get_loop_display_mode()

See what is going to display in the loop.

woocommerce_get_loop_display_mode( ) : string
Tags
since
Return values
string

Either products, subc