• Hello there,

    first of all: GREAT WORK and THANK YOUR FOR THAT AWSOME Plugin.

    It works perfect for my needs. The only problem is if it comes to the Quantity Field
    inside the Popup. It does not work ??

    I use 3 different Plugins to achieve the following:
    Different Min QTYs and Steps on variable products.

    quantity-field-on-shop-page-for-woocommerce
    product-quantity-for-woocommerce-pro
    smntcs-woocommerce-quantity-buttons

    These work on List View and Detail Page like they should. But if it comes to popup than nothing more happens and im not able to push something to card.

    You can test it on the link i sent at the article “Coca Cola” ??

    Do you maybe have a hint for how i could fix this?

    I use the Free Plugin but im willing to buy the premium one if you could grant me that it will work ??

    Thanx a lot in advance.
    Toby

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’ve same issue! Give support for this.

    Thanks Yith!

    • This reply was modified 5 years, 6 months ago by Claudio.
    Plugin Author YITHEMES

    (@yithemes)

    Hi there,
    and thank you for writing in!

    We see in your installation you (or some plugins) add the following code snippet to increase/decrease the quantity:

    jQuery( document ).ready( function ( $ ) {
        $( '.woocommerce .quantity' ).on( 'click', '.minus', function ( e ) {
            var qty  = $( this ).parent().find( 'input.qty' );
            var val  = parseInt( qty.val() );
            var step = qty.attr( 'step' );
            step     = 'undefined' !== typeof( step ) ? parseInt( step ) : 1;
            if ( val > 0 ) {
                qty.val( val - step ).change();
            }
        } );
        $( '.woocommerce .quantity' ).on( 'click', '.plus', function ( e ) {
            var qty  = $( this ).parent().find( 'input.qty' );
            var val  = parseInt( qty.val() );
            var step = qty.attr( 'step' );
            step     = 'undefined' !== typeof( step ) ? parseInt( step ) : 1;
            qty.val( val + step ).change();
        } );
    } );
    
    jQuery( document.body ).on( 'updated_cart_totals', function () {
        jQuery( document ).ready( function ( $ ) {
            $( '.woocommerce .quantity' ).on( 'click', '.minus', function ( e ) {
                var qty  = $( this ).parent().find( 'input.qty' );
                var val  = parseInt( qty.val() );
                var step = qty.attr( 'step' );
                step     = 'undefined' !== typeof( step ) ? parseInt( step ) : 1;
                if ( val > 0 ) {
                    qty.val( val - step ).change();
                }
            } );
            $( '.woocommerce .quantity' ).on( 'click', '.plus', function ( e ) {
                var qty  = $( this ).parent().find( 'input.qty' );
                var val  = parseInt( qty.val() );
                var step = qty.attr( 'step' );
                step     = 'undefined' !== typeof( step ) ? parseInt( step ) : 1;
                qty.val( val + step ).change();
            } );
        } );
    } );
    
    jQuery( document ).on( 'qv_loader_stop', function () {
        jQuery( this ).ready( function ( $ ) {
            $( '#yith-quick-view-modal .quantity' ).on( 'click', '.minus', function ( e ) {
                var qty  = $( this ).parent().find( 'input.qty' );
                var val  = parseInt( qty.val() );
                var step = qty.attr( 'step' );
                step     = 'undefined' !== typeof( step ) ? parseInt( step ) : 1;
                if ( val > 0 ) {
                    qty.val( val - step ).change();
                }
            } );
            $( '#yith-quick-view-modal .quantity' ).on( 'click', '.plus', function ( e ) {
                var qty  = $( this ).parent().find( 'input.qty' );
                var val  = parseInt( qty.val() );
                var step = qty.attr( 'step' );
                step     = 'undefined' !== typeof( step ) ? parseInt( step ) : 1;
                qty.val( val + step ).change();
            } );
        } );
    } );

    To fix this issue you can simply replace that code snippet with the following one:

    jQuery( function ( $ ) {
        $( document ).on( 'click', '.quantity .minus, .quantity .plus', function ( e ) {
            var target = $( e.target ),
                qty    = target.closest( '.quantity' ).find( 'input.qty' ),
                min, max, step, value;
    
            if ( qty.length ) {
                min  = qty.attr( 'min' ) || 0;
                max  = qty.attr( 'max' ) || 0;
                step = qty.attr( 'step' ) || 1;
                min  = parseInt( min );
                max  = parseInt( max );
                step = parseInt( step );
                value = parseInt( qty.val() );
    
                if ( target.is( '.plus' ) ) {
                    value += step;
                } else {
                    value -= step;
                }
    
                value = Math.max( min, value );
                if ( max ) {
                    value = Math.min( max, value );
                }
    
                qty.val( value ).change();
            }
        } );
    } );

    Please try this solution and let us know if everything works fine!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Quick View | Min – Max | QTY Field not working’ is closed to new replies.