From 7553579032933daa4263a006fb45ccd8ada8afd0 Mon Sep 17 00:00:00 2001 From: Jeremy Pry Date: Thu, 28 Sep 2023 10:12:24 -0400 Subject: [PATCH] Use wc_get_template() for the template files --- .../Admin/Orders/MetaBoxes/CustomerHistory.php | 10 +++++++--- .../Admin/Orders/MetaBoxes/SourceAttribution.php | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/CustomerHistory.php b/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/CustomerHistory.php index d7b80bacb0e..ca55277fe0b 100644 --- a/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/CustomerHistory.php +++ b/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/CustomerHistory.php @@ -37,9 +37,13 @@ class CustomerHistory { // 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 ); - $average_spent = $order_count ? $total_spent / $order_count : 0; - // Include the template file. - include dirname( WC_PLUGIN_FILE ) . '/templates/order/customer-history.php'; + $args = array( + 'order_count' => $order_count, + 'total_spent' => $total_spent, + 'average_spent' => $order_count ? $total_spent / $order_count : 0, + ); + + wc_get_template( 'order/customer-history.php', $args ); } } diff --git a/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/SourceAttribution.php b/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/SourceAttribution.php index 177b00be80d..1dc6b666422 100644 --- a/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/SourceAttribution.php +++ b/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/SourceAttribution.php @@ -40,6 +40,6 @@ class SourceAttribution { return; } - include dirname( WC_PLUGIN_FILE ) . '/templates/order/source-data-fields.php'; + wc_get_template( 'order/source-data-fields.php', array( 'meta' => $meta ) ); } }