WooCommerce Code Reference

WC_Products_Tracking
in package

This class adds actions to track usage of WooCommerce Products.

Table of Contents

init()  : mixed
Init tracking.
track_categories_and_tags_view()  : mixed
Send a Tracks event when the Products Categories and Tags page is viewed.
track_product_category_created()  : mixed
Send a Tracks event when a product category is created.
track_product_published()  : mixed
Send a Tracks event when a product is published.
track_product_updated()  : mixed
Send a Tracks event when a product is updated.
track_product_updated_client_side()  : mixed
Track the Update button being clicked on the client side.
track_products_view()  : mixed
Send a Tracks event when the Products page is viewed.

Methods

track_product_category_created()

Send a Tracks event when a product category is created.

public track_product_category_created(int $category_id) : mixed
Parameters
$category_id : int

Category ID.

Return values
mixed

track_product_published()

Send a Tracks event when a product is published.

public track_product_published(string $new_status, string $old_status, object $post) : mixed
Parameters
$new_status : string

New post_status.

$old_status : string

Previous post_status.

$post : object

WordPress post.

Return values
mixed

track_product_updated()

Send a Tracks event when a product is updated.

public track_product_updated(int $product_id, object $post) : mixed
Parameters
$product_id : int

Product id.

$post : object

WordPress post.

Return values
mixed

track_product_updated_client_side()

Track the Update button being clicked on the client side.

public track_product_updated_client_side(WP_Post $post) : mixed

This is needed because track_product_updated (using the edit_post hook) is called in response to a number of other triggers.

Parameters
$post : WP_Post

The post, not used.

Return values
mixed