Created
January 8, 2020 13:16
-
-
Save webdados/6d05558c035617e38e65f9853999cb99 to your computer and use it in GitHub Desktop.
Allow any user (logged in or not) to pay for any other user (or guest) WooCommerce order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'user_has_cap', 'wc_customer_has_capability_override_pay_for_order', 15, 3 ); | |
function wc_customer_has_capability_override_pay_for_order( $allcaps, $caps, $args ) { | |
if ( isset( $caps[0] ) ) { | |
switch ( $caps[0] ) { | |
case 'pay_for_order': | |
$allcaps['pay_for_order'] = true; | |
break; | |
} | |
} | |
return $allcaps; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment