Skip to content

Instantly share code, notes, and snippets.

@JoelEadeDesign
Last active August 29, 2015 14:22
Show Gist options
  • Save JoelEadeDesign/08d4fe717dcf52c96489 to your computer and use it in GitHub Desktop.
Save JoelEadeDesign/08d4fe717dcf52c96489 to your computer and use it in GitHub Desktop.
WooCommerce Remove COD for User Role of Stockist
/* REMOVE COD FOR USER ROLE STOCKIST */
add_filter( 'woocommerce_available_payment_gateways', 'sow_checkout_restrictions', 10, 1 );
function sow_checkout_restrictions( $available_gateways ) {
global $woocommerce;
if (!empty(current_user_can('stockist') )) {
unset( $available_gateways['cod'] );
}
return $available_gateways;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment