Add-to-cart/Waitlist disappears when changing sort order

  • leomoon
    Participant
    # 1 month, 4 weeks ago

    On my site, https://test.antikvarijatknjiga.hr, I use Woocommerce Waitlist plugin which gives ability to place oneself on a waitlist for the product.

    This works well when the archive page is generated after initial search, but, when changing sort order, the add-to-waitlist button disappears. Regular add-to-cart for products that are in-stock works fine.

    For example, https://test.antikvarijatknjiga.hr/?s=krle&post_type=product

    That archive page looks good, it has “Pridruzite se listi cekanja” button in case product is out of stock. But, if we switch to in-stock first, then this option disappears.

    All this works fine with WPSOLR disabled.

    leomoon
    Participant
    # 1 month, 4 weeks ago

    Just to add: the same problem occurs if any of the faucets is selected on the left.

    wpsolr
    Keymaster
    # 1 month, 4 weeks ago

    These buttons are probably added by a javascript code. With the WPSOLR Ajax mode on, the js code is probably not re-triggered when the html code is reloaded.

    You can try to deactivate the Ajax mode.

    wpsolr
    Keymaster
    # 1 month, 4 weeks ago

    WPSOLR triggers an event when the Ajax load is complete:
    $(document).trigger('wpsolr_on_ajax_success');

    You can catch the event to refresh your buttons. WPSOLR use the same principle to refresh some js facets widgets.

    leomoon
    Participant
    # 1 month, 2 weeks ago

    Indeed, I was able to fix this by adding javascript code that Waitlist normally used on document.ready to event wpsolr_on_ajax_success. For others that may have this problem, the shop/hide waitlist buttons functionality is located in wcwl_frontend.min.js

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.