Automattic\WooCommerce\Admin\RemoteInboxNotifications

TotalPaymentsVolumeProcessor::process()publicWC 1.0

Compare against the store's total payments volume.

{} It's a method of the class: TotalPaymentsVolumeProcessor{}

No Hooks.

Return

true|false. The result of the operation.

Usage

$TotalPaymentsVolumeProcessor = new TotalPaymentsVolumeProcessor();
$TotalPaymentsVolumeProcessor->process( $rule, $stored_state );
$rule(object) (required)
The rule being processed by this rule processor.
$stored_state(object) (required)
Stored state.

Code of TotalPaymentsVolumeProcessor::process() WC 7.1.0

public function process( $rule, $stored_state ) {
	$dates      = TimeInterval::get_timeframe_dates( $rule->timeframe );
	$reports_revenue = new RevenueQuery(
		array(
			'before' => $dates['end'],
			'after'  => $dates['start'],
			'interval' => 'year',
			'fields' => array( 'total_sales' ),
		)
	);
	$report_data    = $reports_revenue->get_data();
	$value          = $report_data->totals->total_sales;

	return ComparisonOperation::compare(
		$value,
		$rule->value,
		$rule->operation
	);
}