title: Conditional Cancel Button on my account orders list in Woocommerce
body: <p>This is in reference to <a href="https://stackoverflow.com/questions/46263626/add-cancel-button-on-my-account-orders-list-using-woo-cancel-for-customers-plugi">Add Cancel button on My account Orders list using Woo Cancel for Customers Plugin</a> answer:</p>
  
  <p>I also tried adding the function into functions.php and also get the too few arguments error:
  <a href="https://i.stack.imgur.com/Drugk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Drugk.jpg" alt="enter image description here"></a></p>
  
  <p>I did the same function provided by LoicTheAztec:</p>
  
  <pre><code>add_filter( 'woocommerce_valid_order_statuses_for_cancel', 'custom_valid_order_statuses_for_cancel', 10, 2 );
  function custom_valid_order_statuses_for_cancel( $statuses, $order ){
  
  // Set HERE the order statuses where you want the cancel button to appear
  $custom_statuses    = array( 'pending', 'processing', 'on-hold', 'failed' );
  
  // Set HERE the delay (in days)
  $duration = 3; // 3 days
  
  // UPDATE: Get the order ID and the WC_Order object
  if( isset($_GET['order_id']))
      $order = wc_get_order( absint( $_GET['order_id'] ) );
  
  $delay = $duration*24*60*60; // (duration in seconds)
  $date_created_time  = strtotime($order-&gt;get_date_created()); // Creation date time stamp
  $date_modified_time = strtotime($order-&gt;get_date_modified()); // Modified date time stamp
  $now = strtotime("now"); // Now  time stamp
  
  // Using Creation date time stamp
  if ( ( $date_created_time + $delay ) &gt;= $now ) return $custom_statuses;
  else return $statuses;
  }
  </code></pre>