Add snapshot tracking for Checkout additional fields. (#44310)
* add snapshot tracking * add changelog * address feedback * Add changefile(s) from automation for the following project(s): woocommerce * update changelog * Add changefile(s) from automation for the following project(s): woocommerce * remove the extra changelog --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
ed3aab14cc
commit
0000d754c1
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: add
|
||||||
|
|
||||||
|
Adds Checkout additional fields to the store weekly snapshot.
|
|
@ -15,6 +15,8 @@ use Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore;
|
||||||
use Automattic\WooCommerce\Utilities\{ FeaturesUtil, OrderUtil, PluginUtil };
|
use Automattic\WooCommerce\Utilities\{ FeaturesUtil, OrderUtil, PluginUtil };
|
||||||
use Automattic\WooCommerce\Internal\Utilities\BlocksUtil;
|
use Automattic\WooCommerce\Internal\Utilities\BlocksUtil;
|
||||||
use Automattic\WooCommerce\Proxies\LegacyProxy;
|
use Automattic\WooCommerce\Proxies\LegacyProxy;
|
||||||
|
use Automattic\WooCommerce\Blocks\Package;
|
||||||
|
use Automattic\WooCommerce\Blocks\Domain\Services\CheckoutFields;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
|
@ -1090,6 +1092,19 @@ class WC_Tracker {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get tracker data for additional fields on the checkout page.
|
||||||
|
*
|
||||||
|
* @return array Array of fields count and names.
|
||||||
|
*/
|
||||||
|
public static function get_checkout_additional_fields_data() {
|
||||||
|
$additional_fields_controller = Package::container()->get( CheckoutFields::class );
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'fields_count' => count( $additional_fields_controller->get_additional_fields() ),
|
||||||
|
'fields_names' => array_keys( $additional_fields_controller->get_additional_fields() ),
|
||||||
|
);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Get info about the cart & checkout pages.
|
* Get info about the cart & checkout pages.
|
||||||
*
|
*
|
||||||
|
@ -1104,6 +1119,8 @@ class WC_Tracker {
|
||||||
|
|
||||||
$pickup_location_data = self::get_pickup_location_data();
|
$pickup_location_data = self::get_pickup_location_data();
|
||||||
|
|
||||||
|
$additional_fields_data = self::get_checkout_additional_fields_data();
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'cart_page_contains_cart_shortcode' => self::post_contains_text(
|
'cart_page_contains_cart_shortcode' => self::post_contains_text(
|
||||||
$cart_page_id,
|
$cart_page_id,
|
||||||
|
@ -1119,6 +1136,7 @@ class WC_Tracker {
|
||||||
'checkout_page_contains_checkout_block' => $checkout_block_data['page_contains_block'],
|
'checkout_page_contains_checkout_block' => $checkout_block_data['page_contains_block'],
|
||||||
'checkout_block_attributes' => $checkout_block_data['block_attributes'],
|
'checkout_block_attributes' => $checkout_block_data['block_attributes'],
|
||||||
'pickup_location' => $pickup_location_data,
|
'pickup_location' => $pickup_location_data,
|
||||||
|
'additional_fields' => $additional_fields_data,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue