Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #693804

    Hey there

    Problem URL

    When on page 4 of my pagination if you scroll down to where the quantity’s have the + and – next to them

    (hosted on WPengine) />

    they work as expected. But when scrolling to the bottom of the page and clicking on page 5 you will see the + and – dissapear and get replaced with up / down arrows

    in the quantity boxes. If you do a hard refresh on that page 5 though the + and – reappears. There are no caching plugins installed. We are using WP 4.6.1.

    Please help

    #694101

    Hi,

    Open /config-woocommerce/woocommerce-mod.js and look for line:

    $( document ).on( 'updated_cart_totals', avia_apply_quant_btn );
    

    Replace it by this:

    $( document ).on( 'updated_cart_totals', avia_apply_quant_btn );
    $( document ).on( 'facetwp-refresh', avia_apply_quant_btn );
    

    Regards,
    Josue

    #694495

    Hey there

    i applied your change but unfortunately it’s made no difference.

    We are using this function in functions.php

    add_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 2 );
    function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
    	if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
    		$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
    		$html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>';
    		$html .= woocommerce_quantity_input( array(), $product, false );
    		$html .= '</form>';
    	}
    	return $html;
    }
    

    And then our quantity-input.php looks like this

    <div class="quantity">
    	<input type="number" step="<?php echo esc_attr( $step ); ?>" min="<?php echo esc_attr( $min_value ); ?>" max="<?php echo esc_attr( $max_value ); ?>" name="<?php echo esc_attr( $input_name ); ?>" value="<?php echo esc_attr( $input_value ); ?>" title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ) ?>" id="quantity-<?php echo $product->id;?>" class="input-text qty text" size="4" pattern="<?php echo esc_attr( $pattern ); ?>" inputmode="<?php echo esc_attr( $inputmode ); ?>" />
    </div>
    

    I’ve also applied your suggested fix to woocommerce-mod.js

    	$( document ).on( 'updated_cart_totals', avia_apply_quant_btn );
    	$( document ).on( 'facetwp-refresh', avia_apply_quant_btn );
    

    Any other suggestions ?

    #695130

    Hey there

    Any other suggestions here ?

    #696164

    Just a solution here in case it helps anyone with the same issue.

    Find this code

    $( document ).on( 'updated_cart_totals', avia_apply_quant_btn );
    $( document ).on( 'facetwp-refresh', avia_apply_quant_btn );
    

    Apply this code below it

    $(document).ajaxStop(function () {
        	avia_apply_quant_btn();    
    });

    This applies the quantity buttons when the ajax has finished loading / stopped

    #696177

    Hi!

    Thanks a lot for sharing the solution, we really appreciate it.

    Please do let us knwo if we can do anything else for you

    Regards,
    Basilis

    #696529

    Just on the back of my solution previously

    The FacetWP developers got back to me and said that this line

    $( document ).on( 'facetwp-refresh', avia_apply_quant_btn );

    Should be this

    $( document ).on( 'facetwp-loaded', avia_apply_quant_btn );

    ‘facetwp-refresh’ happens when the ajax call starts. But you’ll need to use ‘facetwp-loaded’ for it to apply after the ajax call.

    However now i have a different issue but it is related. if you look at this problem here

    Problem URL

    You will see i’m echoing the Add to cart url above the button. If you then scroll down to the bottom and click on page 5 you will those URL’s change from

    /products/?fwp_paged=4&add-to-cart=5948

    to

    /wp-admin/admin-ajax.php?add-to-cart=5941

    Something is not being applied to the buttons but not sure what. If you add a product to cart on page 4 it works perfect but clicking add to cart on page 5 or any other page returns a 0 on a white page.

    Can you help out here ?

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Quantity Multipliers Dissapear On Pagination Links’ is closed to new replies.