我用谷歌搜索了这个错误但是没有任何想法,为什么会发生这种情况,请帮我解决以下错误,
function add_request_refund( $actions, $order ) {
$order_date = $order->order_date;
$getTodayDate = date('m/d/Y');
$date1 = date_create($order_date);
$date2 = date_create($getTodayDate);
//difference between two dates
$diff = date_diff($date2,$date1);
if ( $order->has_status( 'completed' ) && $diff->days < 15 ) {
$actions['refund_request'] = array(
'url' => url_of_request_refund( $order ),
'name' => __( 'Request Refund', 'my-textdomain' ),
);
}
return $actions;
}
add_filter( 'woocommerce_my_account_my_orders_actions', 'add_request_refund', 100, 2 );
function url_of_request_refund( $order ) {
$page_id = 4007;
$refund_url = trailingslashit( get_page_link( $page_id ) ) . '?order=' . $order->get_order_number();
return $refund_url;
}