Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors
TotalPaymentsVolumeProcessor::process()
Compare against the store's total payments volume.
Метод класса: TotalPaymentsVolumeProcessor{}
Хуков нет.
Возвращает
true|false
. The result of the operation.
Использование
$TotalPaymentsVolumeProcessor = new TotalPaymentsVolumeProcessor(); $TotalPaymentsVolumeProcessor->process( $rule, $stored_state );
- $rule(объект) (обязательный)
- The rule being processed by this rule processor.
- $stored_state(объект) (обязательный)
- Stored state.
Код TotalPaymentsVolumeProcessor::process() TotalPaymentsVolumeProcessor::process WC 9.5.1
public function process( $rule, $stored_state ) { $dates = TimeInterval::get_timeframe_dates( $rule->timeframe ); $reports_revenue = $this->get_reports_query( array( 'before' => $dates['end'], 'after' => $dates['start'], 'interval' => 'year', 'fields' => array( 'total_sales' ), ) ); $report_data = $reports_revenue->get_data(); if ( ! $report_data || ! isset( $report_data->totals->total_sales ) ) { return false; } $value = $report_data->totals->total_sales; return ComparisonOperation::compare( $value, $rule->value, $rule->operation ); }