autoship_strip_actions (function)

(src/scheduled-orders.php) Hooked to the ' autoship_get_account_scheduled_orders_actions filter and currently removes the Delete, Failed, and Pending unsupported actions from the Scheduled Orders screen and an additional $context parameter which can be used to adjust the actions based on the context in which the actions are being displayed. 

Example

/**
* Strips Unsupported Actions
*
* @param array $actions The current actions
* @param string $status The current order's status.
* @param string $context Context in which the actions are being displayed.
*
* @return array The resulting actions.
*/
function autoship_strip_actions( $actions, $status, $context ){

  // Remove Unsupported Actions.
  unset( $actions['Failed'] );
  unset( $actions['Pending'] );

  // Remove Non-Singular View Actions.
  if ( 'order' == $context || 'empty-order' == $context ){
    unset( $actions['Edit'] );
    unset( $actions['View'] );
  } else {
    unset( $actions['Create'] );
  }

  return $actions;
}

Still need help? Contact Us Contact Us