mirror of
https://github.com/pronamic/woocommerce-subscriptions.git
synced 2025-10-17 14:52:56 +00:00
2.5.3
This commit is contained in:

committed by
Remco Tolsma

parent
99a693a46f
commit
e38fdb9d42
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user