diff --git a/plugins/woocommerce/phpcs.xml b/plugins/woocommerce/phpcs.xml
index c4b4a07e733..85134575ec9 100644
--- a/plugins/woocommerce/phpcs.xml
+++ b/plugins/woocommerce/phpcs.xml
@@ -102,4 +102,16 @@
tests/php/
+
+
+ tests/php/src
+
+
+
+ tests/php/src
+
+
+
+ tests/php/src
+
diff --git a/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/CustomerHistory.php b/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/CustomerHistory.php
index ca55277fe0b..04d56c3f947 100644
--- a/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/CustomerHistory.php
+++ b/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/CustomerHistory.php
@@ -35,8 +35,8 @@ class CustomerHistory {
*/
private function display_customer_history( int $customer_id ) {
// Calculate the data needed for the template.
- $order_count = wc_get_customer_order_count( $customer_id );
- $total_spent = wc_get_customer_total_spent( $customer_id );
+ $order_count = wc_get_customer_order_count( $customer_id );
+ $total_spent = wc_get_customer_total_spent( $customer_id );
$args = array(
'order_count' => $order_count,
diff --git a/plugins/woocommerce/src/Internal/Integrations/WPConsentAPI.php b/plugins/woocommerce/src/Internal/Integrations/WPConsentAPI.php
index 3484fc21a84..f9854933679 100644
--- a/plugins/woocommerce/src/Internal/Integrations/WPConsentAPI.php
+++ b/plugins/woocommerce/src/Internal/Integrations/WPConsentAPI.php
@@ -37,7 +37,7 @@ class WPConsentAPI {
* @return void
*/
protected function on_plugins_loaded() {
- // Include integration to WP Consent Level API if available
+ // Include integration to WP Consent Level API if available.
if ( ! $this->is_wp_consent_api_active() ) {
return;
}
diff --git a/plugins/woocommerce/src/Internal/Orders/SourceAttributionController.php b/plugins/woocommerce/src/Internal/Orders/SourceAttributionController.php
index 79e6f11f074..221eb19d5a9 100644
--- a/plugins/woocommerce/src/Internal/Orders/SourceAttributionController.php
+++ b/plugins/woocommerce/src/Internal/Orders/SourceAttributionController.php
@@ -22,6 +22,9 @@ use WP_User;
* Class SourceAttributionController
*
* @since x.x.x
+ *
+ * phpcs:disable WordPress.PHP.DisallowShortTernary
+ * phpcs:disable Generic.Commenting.DocComment.MissingShort
*/
class SourceAttributionController implements RegisterHooksInterface {
@@ -56,8 +59,9 @@ class SourceAttributionController implements RegisterHooksInterface {
*
* @internal
*
- * @param LegacyProxy $proxy The legacy proxy.
- * @param WC_Logger_Interface|null $logger The logger object. If not provided, it will be obtained from the proxy.
+ * @param LegacyProxy $proxy The legacy proxy.
+ * @param FeaturesController $controller The feature controller.
+ * @param WC_Logger_Interface $logger The logger object. If not provided, it will be obtained from the proxy.
*/
final public function init( LegacyProxy $proxy, FeaturesController $controller, ?WC_Logger_Interface $logger = null ) {
$this->proxy = $proxy;
@@ -183,13 +187,40 @@ class SourceAttributionController implements RegisterHooksInterface {
true
);
+ /**
+ * Filter the lifetime of the cookie used for source tracking.
+ *
+ * @since x.x.x
+ *
+ * @param int $lifetime The lifetime of the cookie in months.
+ */
+ $lifetime = (int) apply_filters( 'wc_order_source_attribution_cookie_lifetime_months', 6 );
+
+ /**
+ * Filter the session length for source tracking.
+ *
+ * @since x.x.x
+ *
+ * @param int $session_length The session length in minutes.
+ */
+ $session_length = (int) apply_filters( 'wc_order_source_attribution_session_length_minutes', 30 );
+
+ /**
+ * Filter to allow tracking.
+ *
+ * @since x.x.x
+ *
+ * @param bool $allow_tracking True to allow tracking, false to disable.
+ */
+ $allow_tracking = wc_bool_to_string( apply_filters( 'wc_order_source_attribution_allow_tracking', true ) );
+
// Pass parameters to Order Source Attribution JS.
$params = array(
- 'lifetime' => (int) apply_filters( 'wc_order_source_attribution_cookie_lifetime_months', 6 ),
- 'session' => (int) apply_filters( 'wc_order_source_attribution_session_length_minutes', 30 ),
+ 'lifetime' => $lifetime,
+ 'session' => $session_length,
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'prefix' => $this->field_prefix,
- 'allowTracking' => wc_bool_to_string( apply_filters( 'wc_order_source_attribution_allow_tracking', true ) ),
+ 'allowTracking' => $allow_tracking,
);
wp_localize_script( 'woocommerce-order-source-attribution-js', 'wc_order_attribute_source_params', $params );
@@ -295,7 +326,8 @@ class SourceAttributionController implements RegisterHooksInterface {
/**
* Save source data for an Order object.
*
- * @param WC_Order $order The order object.
+ * @param array $source_data The source data.
+ * @param WC_Order $order The order object.
*
* @return void
*/
diff --git a/plugins/woocommerce/src/Internal/Traits/SourceAttributionMeta.php b/plugins/woocommerce/src/Internal/Traits/SourceAttributionMeta.php
index 38505ce8c95..06c265fa957 100644
--- a/plugins/woocommerce/src/Internal/Traits/SourceAttributionMeta.php
+++ b/plugins/woocommerce/src/Internal/Traits/SourceAttributionMeta.php
@@ -1,12 +1,4 @@
get_device_type( $values );
}
- // Set the origin label
+ // Set the origin label.
if ( array_key_exists( 'type', $values ) && array_key_exists( 'utm_source', $values ) ) {
$values['origin'] = $this->get_origin_label( $values['type'], $values['utm_source'] );
}
diff --git a/plugins/woocommerce/src/Internal/WCCom/TrackingController.php b/plugins/woocommerce/src/Internal/WCCom/TrackingController.php
index 34a17b09fcc..fc338ba77be 100644
--- a/plugins/woocommerce/src/Internal/WCCom/TrackingController.php
+++ b/plugins/woocommerce/src/Internal/WCCom/TrackingController.php
@@ -12,6 +12,8 @@ use Automattic\WooCommerce\Internal\Traits\ScriptDebug;
* Class TrackingController
*
* @since x.x.x
+ *
+ * phpcs:disable Generic.Commenting.DocComment.MissingShort
*/
class TrackingController implements RegisterHooksInterface {
@@ -25,6 +27,8 @@ class TrackingController implements RegisterHooksInterface {
/**
* WCCOMTracking init.
*
+ * @internal
+ *
* @param FeaturesController $features_controller Features controller.
*/
final public function init( FeaturesController $features_controller ) {
diff --git a/plugins/woocommerce/src/Utilities/VersionUtil.php b/plugins/woocommerce/src/Utilities/VersionUtil.php
index 249f765b859..0a793304918 100644
--- a/plugins/woocommerce/src/Utilities/VersionUtil.php
+++ b/plugins/woocommerce/src/Utilities/VersionUtil.php
@@ -9,6 +9,8 @@ use Automattic\WooCommerce\Proxies\LegacyProxy;
* Class VersionUtil
*
* @since x.x.x
+ *
+ * phpcs:disable Generic.Commenting.DocComment.MissingShort
*/
class VersionUtil {
@@ -19,8 +21,9 @@ class VersionUtil {
* Init this class instance.
*
* @since x.x.x
+ * @internal
*
- * @param LegacyProxy $proxy
+ * @param LegacyProxy $proxy The legacy proxy instance.
*
* @return void
*/
diff --git a/plugins/woocommerce/templates/order/customer-history.php b/plugins/woocommerce/templates/order/customer-history.php
index b4546e0a195..4755812a1e6 100644
--- a/plugins/woocommerce/templates/order/customer-history.php
+++ b/plugins/woocommerce/templates/order/customer-history.php
@@ -1,15 +1,16 @@