Limit to 1 item feature and awkward link to WooCommerce in Order

Hello support team !

I am still experimenting / doing acceptance testing with HivePress, and I am a little surprised to find you can set a quantity on Marketplace products…

I’ve seen this post : Allow sellers to limit quantity, but as you can see on this screenshot the quantity can be changed, if you fall by happenstance on the actual product page.

So I went in the back-end, to tick this checkbox (limit purchases to one item per order) :

You may want to put this limit on ALL products, as long as you only deal with Marketplace products, i.e. “packages” and “featured” products.

So I found this code snippet, that could be of use :

//credits : https://wpfactory.com/blog/how-to-allow-only-one-quantity-in-your-woocommerce-store/
// Restrict quantity to 1 for WooCommerce products
function custom_restrict_quantity_to_one($min, $product) {
    return 1;
}
add_filter('woocommerce_quantity_input_min', 'custom_restrict_quantity_to_one', 10, 2);
add_filter('woocommerce_quantity_input_max', 'custom_restrict_quantity_to_one', 10, 2);

// Display only one quantity in the cart and checkout
function custom_update_cart_quantity($cart_item_data, $product_id) {
    if (isset($cart_item_data['quantity']) && $cart_item_data['quantity'] > 1) {
        $cart_item_data['quantity'] = 1;
    }
    return $cart_item_data;
}
add_filter('woocommerce_add_cart_item_data', 'custom_update_cart_quantity', 10, 2);
add_filter('woocommerce_update_cart_item', 'custom_update_cart_quantity', 10, 2);

Actually, it’s not so hard to come across the product you just bought, there’s link pointing to it in your orders, in the dashboard !

So I come up with this nifty jQuery snippet, to remove the link :

jQuery('.hp-template--order-edit-page .product-name a').contents().unwrap();

Not perfect, but it mitigates the risk of the user coming across the product page !
It should be part of the marketplace/paid listings plugin, if you ask me.

At the very least you should mention it in your documentation, tutorials.

In the above screenshot, it’s the “featured listing” product.
I tested, buying two of them for instance, then went back to my listings (Dashboard > Listings), you would imagine I have two “credits” to mark my listings as featured, but that’s not the way it works, I am redirected to the checkout page once again !

I did not want to put you on the spot, and mark it as “bug”, but maybe it should.

My two cents,

Thanks for reporting this issue, indeed we can use this WooCommerce option to restrict one-time purchases if these are not allowed in HivePress Marketplace settings. We’ll also add redirect from the linked WooCommerce pages to the listing pages.