autoship_strip_actions

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 has been updated with an additional context parameter which can be used to adjust the actions based on the context in which the actions are being displayed. The function has been updated to also exclude the Edit and View actions if the current context is the Scheduled Order detail screen.

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 ){
    unset( $actions['Edit'] );
    unset( $actions['View'] );
  }

  return $actions;
}

Still need help? Contact Us Contact Us