From 5eab1cbdba851a63383157f708ac35d01122a37d Mon Sep 17 00:00:00 2001 From: Rebecca Scott Date: Wed, 18 Mar 2020 15:10:14 +1000 Subject: [PATCH] Get product type instead of category IDs and split out virtual and downloadable --- includes/tracks/events/class-wc-products-tracking.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/tracks/events/class-wc-products-tracking.php b/includes/tracks/events/class-wc-products-tracking.php index a51ec4e2940..161c5137570 100644 --- a/includes/tracks/events/class-wc-products-tracking.php +++ b/includes/tracks/events/class-wc-products-tracking.php @@ -39,11 +39,13 @@ class WC_Products_Tracking { WC_Tracks::record_event( 'product_edit', $properties ); - $product = new WC_Product( $product_id ); + $product_factory = new WC_Product_Factory(); + $product = $product_factory->get_product( $product_id ); $update_properties = array( 'product_id' => $product_id, - // 'product_type' => TODO where does this come from?? there is no product type, only category ids. - 'category_ids' => $product->get_category_ids(), + 'product_type' => $product->get_type(), + 'is_virtual' => $product->get_virtual(), + 'is_downloadable' => $product->get_downloadable(), 'manage_stock' => 0 == $product->get_manage_stock() ? 'N' : 'Y', // 'stock_quantity_update' => 'Y' TODO this may require hooking in to product edit at a lower level, which doesn't seem possible for an extension. // You can only get the current product, not the product before the update...