• Resolved kamenbereg

    (@kamenbereg)


    Hello. I use the Facetwp plugin to display posts. After clicking the “Load More” button, the Ajax button doesn’t work. I tried the following code, but it didn’t help:

    document.addEventListener(‘facetwp-loaded’, function() {
    if ( FWP.loaded ) {
    const {cart} = e.detail;
    const mcSection = cart.querySelector(‘.wpsc-manual-checkout-section’);
    new WPSCManualCheckout(mcSection);
    }
    });


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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor mbrsolution

    (@mbrsolution)

    Thank you for reaching out to us. Unfortunately we don’t have an integration addon for the plugin you mentioned “Facetwp”.

    Kind regards.

    Thread Starter kamenbereg

    (@kamenbereg)

    Found a solution

    add_action( 'facetwp_scripts', function() {
    ?>
    <script>
    function initWPSCProducts() {
    const products = document.querySelectorAll('.wpsc_product');
    products.forEach((product) => {
    // Чтобы не инициализировать повторно, можно добавить проверку:
    if (!product.classList.contains('wpsc-initialized')) {
    new WPSCProduct(product);
    product.classList.add('wpsc-initialized');
    }
    });
    }
    // При первичной загрузке
    document.addEventListener('DOMContentLoaded', initWPSCProducts);
    // После AJAX-обновления FacetWP
    document.addEventListener('facetwp-loaded', initWPSCProducts);
    </script>
    <?php
    }, 100 );
    Plugin Contributor mbrsolution

    (@mbrsolution)

    That is great news. Well done. I am marking this thread as resolved. Enjoy the plugin.

    Kind regards.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.