Use wc_get_template() for the template files
This commit is contained in:
parent
0cb181bd9f
commit
7553579032
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 ) );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue