• Resolved elliecoxy

    (@elliecoxy)


    This plugin is no longer working for us, we have minimum’s set on a lot of products (both single products and variable) and this plugin has worked for us fine, but now it is not working and all products have gone back to 1 as the minimum order. Any help would be great.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Ashok G

    (@wpashokg)

    @elliecoxy,
    can you share me admin screenshot of this specific product that you’ve shared.

    Thread Starter elliecoxy

    (@elliecoxy)

    I have emailed you a screenshot, thanks

    I’ve found a fix for this. The follow code is properly styled, fully compatible and works correctly, i.e. it adds the correct minimum quantity to the cart for simple products and links variable product buttons to the respective product page:

    
    add_filter( 'woocommerce_loop_add_to_cart_link','_wcmmax_add2cart' );
    function _wcmmax_add2cart( $link ) {
    	global $product;
    	$product_id = $product->get_id();
    	$product_sku = $product->get_sku();
    	$product_type = $product->get_type();
    	$qtylink = ''; 
    	$mmaxEnable = get_post_meta( $product_id, '_wc_mmax_prd_opt_enable', true );
    	$minQty     = get_post_meta( $product_id, '_wc_mmax_min', true );
    
    	if ( $product_type != 'simple' || $mmaxEnable != 1 ){
    		return $link;
    	}
    	$qtylink = '&quantity='.$minQty;
    	$ajax_cart_en = 'yes' === get_option( 'woocommerce_enable_ajax_add_to_cart' );
    	if ( $ajax_cart_en && $mmaxEnable == 0 ) {
    		$ajax_class = 'ajax_add_to_cart';
    	}
    	$link = sprintf( '<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="button %s product_type_%s %s">%s</a>',
    		esc_url( $product->add_to_cart_url().$qtylink ),
    		esc_attr( $product_id ),
    		esc_attr( $product->get_sku() ),
    		esc_attr( isset( $minQty ) ? $minQty : 1 ),
    		$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
    		esc_attr( $product->product_type ),
    		esc_attr( $ajax_class ),
    		esc_html( $product->add_to_cart_text() )
    	);
    	return $link;
    }
    

    @wpashokg please udpate the plugin.

    Plugin Author Ashok G

    (@wpashokg)

    @elliecoxy, @galbaras, update to the latest version of plugin and check now.

    Thread Starter elliecoxy

    (@elliecoxy)

    Thank you both, it is now working again

    Hi there,

    I am using your Woocommerce Minimum and Maximum Quantity on my website as well as the WP Clever frequently bought together premium plugin. I am not sure if they are not compatible or what the problem is, but as soon as I activate your plugin the qty’s will not stay on 0 they start on 1 and you have to either click the + or – to get it to add the amount to the bottom and to the cart? I have set the default qty in the bought together products to 0. When I deactivate your plugin the default qty is 0, when I activate your plugin it becomes a 1.

    Do you perhaps know why it’s doing that and is there a way to fix it?
    Here is the link to the product page: https://www.adroitscada.com/catalog/shop/adroit-ignite/adroit-agent-server-ignite-8-agents/

    Kind Regards,

    Sam

    This thread has been marked as “resolved”. You should start a new thread with a better title.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Minimum Qty no longer working’ is closed to new replies.