WC_Products_Tracking::track_product_published( string $new_status, string $old_status, object $post )

Send a Tracks event when a product is published.


Description Description


Parameters Parameters

$new_status

(Required) New post_status.

$old_status

(Required) Previous post_status.

$post

(Required) WordPress post.


Top ↑

Source Source

File: includes/tracks/events/class-wc-products-tracking.php

	public function track_product_published( $new_status, $old_status, $post ) {
		if (
			'product' !== $post->post_type ||
			'publish' !== $new_status ||
			'publish' === $old_status
		) {
			return;
		}

		$properties = array(
			'product_id' => $post->ID,
		);

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


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.