• Resolved netzmaedchen

    (@netzmaedchen)


    Hi there, I have tested this plugin but I have a problem with it. It seems to disable the Woocommerce setting “Enable this to only allow one of this item to be bought in a single order” in Inventory settings. I want the customer to NOT be able to suggest a price twice for the same product.
    As soon as I deactivate your plugin, it works and I get the message “You can’t add another “myproduct” to your cart”.
    How can I keep this functionality intact while still using your plugin?
    Thank you very much.
    Regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WPClever

    (@wpclever)

    Hi @netzmaedchen

    Please add below code to current-theme (or child-theme) / functions.php

    add_filter( 'woocommerce_add_to_cart_sold_individually_found_in_cart', 'woonp_individually_found_in_cart', 10, 2 );
    function woonp_individually_found_in_cart( $found_in_cart, $product_id ) {
    	if ( woonp_check_in_cart( $product_id ) ) {
    		return true;
    	}
    
    	return $found_in_cart;
    }
    
    if ( ! function_exists( 'woonp_check_in_cart' ) ) {
    	function woonp_check_in_cart( $product_id ) {
    		foreach ( WC()->cart->get_cart() as $cart_item ) {
    			if ( $cart_item['product_id'] === $product_id ) {
    				return true;
    			}
    		}
    
    		return false;
    	}
    }
    Thread Starter netzmaedchen

    (@netzmaedchen)

    @wpclever thank you so much!!! Works like it should!
    Is there a premium version for this plugin? Couldn’t find it on your site….
    Thanks!
    Regards
    Anja

    Plugin Author WPClever

    (@wpclever)

    @netzmaedchen that is good news! Thanks for your informing us on this issue.

    Currently, we only have the free version of this plugin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Allow only one price suggestion per product’ is closed to new replies.