WordPress at Your Fingertips
function is not described

WC_Products_Tracking::track_product_updated_client_side() public WC 1.0

Track the Update button being clicked on the client side. This is needed because track_product_updated (using the edit_post is called in response to a number of other triggers.

{} It's a method of the class: WC_Products_Tracking{}

No Hooks.

Return

null. Nothing.

Usage

$WC_Products_Tracking = new WC_Products_Tracking();
$WC_Products_Tracking->track_product_updated_client_side( $post );
$post(WP_Post) (required)
The post, not used.

Code of WC_Products_Tracking::track_product_updated_client_side() WC 5.8.0

public function track_product_updated_client_side( $post ) {
	wc_enqueue_js(
		"
		if ( $( 'h1.wp-heading-inline' ).text().trim() === '" . __( 'Edit product', 'woocommerce' ) . "') {
			var initialStockValue = $( '#_stock' ).val();
			var hasRecordedEvent = false;

			$( '#publish' ).on( 'click', function() {
				if ( hasRecordedEvent ) {
					return;
				}

				var currentStockValue = $( '#_stock' ).val();
				var properties = {
					product_type:			$( '#product-type' ).val(),
					is_virtual:				$( '#_virtual' ).is( ':checked' ) ? 'Y' : 'N',
					is_downloadable:		$( '#_downloadable' ).is( ':checked' ) ? 'Y' : 'N',
					manage_stock:			$( '#_manage_stock' ).is( ':checked' ) ? 'Y' : 'N',
					stock_quantity_update:	( initialStockValue != currentStockValue ) ? 'Y' : 'N',
				};

				window.wcTracks.recordEvent( 'product_update', properties );
				hasRecordedEvent = true;
			} );
		}
		"
	);
}