Last active
February 16, 2020 09:11
-
-
Save jasperf/54af822f7e971d0a68b653bb9e24ecc0 to your computer and use it in GitHub Desktop.
WooCommerce Filter on user role to display minimum quantity of products with https://wordpress.org/plugins/product-quantity-for-woocommerce/
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
add_filter( 'alg_wc_pq_get_product_qty_min', 'my_product_qty_min_by_user_role', 10, 2 ); | |
function my_product_qty_min_by_user_role( $qty, $product_id ) { | |
$current_user = wp_get_current_user(); | |
return ( in_array( 'bedrijf', $current_user->roles ) ? 10 : $qty ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment