WC_Products_Tracking::track_product_updated()publicWC 1.0

Send a Tracks event when a product is updated.

Method of the class: WC_Products_Tracking{}

Hooks from the method

Return

null. Nothing (null).

Usage

$WC_Products_Tracking = new WC_Products_Tracking();
$WC_Products_Tracking->track_product_updated( $product_id, $post );
$product_id(int) (required)
Product id.
$post(object) (required)
WordPress post.

WC_Products_Tracking::track_product_updated() code WC 8.9.0

public function track_product_updated( $product_id, $post ) {
	if ( 'product' !== $post->post_type ) {
		return;
	}

	/* phpcs:disable WooCommerce.Commenting.CommentHooks.MissingHookComment */
	$source     = apply_filters( 'woocommerce_product_source', self::TRACKS_SOURCE );
	$properties = array(
		'product_id' => $product_id,
		'source'     => $source,
	);
	/* phpcs: enable */

	WC_Tracks::record_event( 'product_edit', $properties );
}