Hi Carlos,
Sorry for the late reply.
This can be done with our plugin, however, you will need to: a) add a small PHP snippet to your (child) theme’s functions.php file, and b) assign all your products to some category or tag.
If that’s good enough – here is what you need to do:
1. To limit the total number of products to 3 – as mentioned, you need to assign all your products to some category or tag. After that you need to enable “Per product category” (or “Per product tag”) option in “WooCommerce > Settings > Maximum Products per User > Limits”, and then set “Limit per user” option for that category (or tag) (in “Products > Categories > Your category > Edit”) to “3”.
2. Now to add an additional “one product only” requirement, you will need to add this snippet:
add_filter( 'alg_wc_mppu_check_quantities_for_product', 'my_alg_wc_mppu_limit_all_products_to_one', 10, 3 );
if ( ! function_exists( 'my_alg_wc_mppu_limit_all_products_to_one' ) ) {
/**
* Sets max quantity for all products to one.
*/
function my_alg_wc_mppu_limit_all_products_to_one( $is_valid, $core, $args ) {
if ( $is_valid ) {
$max_qty_all_products = 1;
$user_already_bought = $core->get_user_already_bought_qty( $args['product_id'], $args['current_user_id'], true );
if ( ( $user_already_bought + $args['cart_item_quantity'] ) > $max_qty_all_products ) {
if ( $args['do_add_notices'] ) {
$core->output_notice( $args['product_id'], $max_qty_all_products, $user_already_bought, $args['is_cart'], $args['cart_item_quantity'], 0 );
}
return false;
}
}
return $is_valid;
}
}
Please give it a try and let me know if you have any questions.