LLMS_Analytics::get_total_sales_last_n_days( $number_of_days = 7 )


Description Description


Source Source

File: includes/class.llms.analytics.php

	public static function get_total_sales_last_n_days( $number_of_days = 7 ) {

		$total = 0;
		$args = array(
				'post_type' 		=> 'llms_order',
				'posts_per_page'	=> 5000,
				'meta_query' 		=> array(),
				'date_query' => array(
						array(
								'after' => $number_of_days . ' day ago',
						),
				),
		);

		$orders = get_posts( $args );
		foreach ( $orders as $order ) {
			$total += get_post_meta( $order->ID, '_llms_order_total', true );
		}

		return LLMS_Number::format_money_no_decimal( $total );
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.