Support » Plugin: WooCommerce » Re- Initialize Single Product Page loaded by Ajax

  • i loaded a single product pages div elements via ajax into fancybox

    and i was wondering what a good step would be to go about re-initializing the javascript functions of wordpress

    right now it all shows up….but good luck selecting a variation and gettin the cart button to show….all of the javascript is broken

    i wish there was a way to have the already loaded javascript of my page bind to the dom elements in the fancybox as soon as they load

Viewing 1 replies (of 1 total)
  • I’m facing the same problem, WC javascript doesn’t get available thru the DOM. Tho, there’s something I’ve noticed…

    Your AJAX loaded template should have wp_head() and wp_footer(). All of WC templates use get_header(‘shop’) and get_footer(‘shop’) while there’s actually no ‘header-shop.php’ and ‘footer-shop.php’ files included.

    Of course, you could create these two and let ‘header-shop.php’ be the one-line-of-code PHP page, like so
    …and ‘footer-shop.php’ another file containing only

    That’s how WC required javascript gets loaded but there’s another problem: WordPress will automatically insert default META and LINK into your ajax content DIV. Even if you strip those down with

    remove_action('wp_head', 'wp_print_styles');
    remove_action('wp_head', 'wp_generator');
    // all available by WP

    …there will be a couple of more inserted by WC.

    So, I guess the only proper method to make things work properly is to make WC javascript available to the DOM once enqueued.

Viewing 1 replies (of 1 total)
  • The topic ‘Re- Initialize Single Product Page loaded by Ajax’ is closed to new replies.