This commit is contained in:
Prospress Inc
2019-04-05 09:35:18 +02:00
committed by Remco Tolsma
parent 99a693a46f
commit e38fdb9d42
118 changed files with 4680 additions and 2532 deletions

View File

@@ -747,6 +747,8 @@ function wcs_display_item_meta( $item, $order ) {
* @return void
*/
function wcs_display_item_downloads( $item, $order ) {
wcs_deprecated_function( __FUNCTION__, '2.5.0', 'wc_display_item_downloads( $item )' );
if ( function_exists( 'wc_display_item_downloads' ) ) { // WC 3.0+
wc_display_item_downloads( $item );
} else {
@@ -865,4 +867,32 @@ function wcs_copy_payment_method_to_order( $subscription, $order ) {
if ( ! empty( $payment_meta ) ) {
wcs_set_payment_meta( $order, $payment_meta );
}
}
/**
* Returns how many minutes ago the order was created.
*
* @param WC_Order $order
*
* @return int
* @since 2.5.3
*/
function wcs_minutes_since_order_created( $order ) {
$now = new WC_DateTime( 'now', $order->get_date_created()->getTimezone() );
$diff_in_minutes = $now->diff( $order->get_date_created() );
return absint( $diff_in_minutes->i );
}
/**
* Returns how many seconds ago the order was created.
*
* @param WC_Order $order
*
* @return int
* @since 2.5.3
*/
function wcs_seconds_since_order_created( $order ) {
return time() - $order->get_date_created()->getTimestamp();
}