Title: [FIX] Quick View compatibility
Last modified: March 6, 2021

---

# [FIX] Quick View compatibility

 *  Resolved [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fix-quick-view-compatibility/)
 * I’m using a Woocommerce feature named Quick View (QV), which opens single products
   from the product catalog in a modal window via Ajax.
 * The QV feature isn’t being handled by PP out of the box, and other similar plugins
   I’ve tested so far (e.g. Flying Images, Statically). What’s mostly lacking are
   the phast-optimized images being referred in the HTML of the Ajax output, to 
   avoid the browser fetching them again unoptimized during the QV of each product.
 * [Thanks to the kind addition](https://wordpress.org/support/topic/applying-pp-programatically-on-html/#post-14132217)
   of `phastpress_optimize_snippet` in 1.102. update, have managed to address the
   issue in PP. The code below targets [YITH QuickView](https://wordpress.org/plugins/yith-woocommerce-quick-view/),
   but should work for other QV’s as well (also tested on QV of the Flatsome theme),
   as many seem to share the same pattern of loading their templates via Ajax.
 *     ```
       // added in functions.php
       // Inject custom hook to allow modifying the HTML content before Ajax output
       add_action( 'woocommerce_after_template_part', 'qv_after_template_part' ); 
       function qv_after_template_part( $template_name ) { 
           if( $template_name == 'yith-quick-view-content.php'           // YITH QV 
            || $template_name == 'content-single-product-lightbox.php' ) // Flatsome QV
   
               do_action('my_action_product_quick_view_ajax_html');
       }
       // Rewrite HTML content inside QV with optimizations
       add_action( 'my_action_product_quick_view_ajax_html', 'pp_qv_optimize' );
       function pp_qv_optimize() {
           if( !function_exists('phastpress_optimize_snippet') ) 
               return;
   
           // capture & clear QV's buffer, already containing the template data
           $buffer = ob_get_clean();
           // create a new QV buffer entry point, to be retrieved and cleared in QV itself
           ob_start();
   
           echo html_entity_decode( phastpress_optimize_snippet( $buffer ) );
           //error_log( var_export( ob_get_contents(), true ) );
       }
       ```
   

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

 *  Plugin Author [Albert Peschar](https://wordpress.org/support/users/kiboit/)
 * (@kiboit)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/fix-quick-view-compatibility/#post-14150014)
 * Hi [@alx359](https://wordpress.org/support/users/alx359/),
 * Cool! I’ve added a fix for this to PhastPress 1.106.
 * To make this more robust I’ve taken a slightly different approach and hook into
   the `admin-ajax.php` handling code, to add PhastPress’ output buffer handler 
   in case the AJAX hook is in a list.
 * So far, it’s only configured for YITH WooCommerce Quick View, but other AJAX 
   endpoints can be added as well in future.
 * –Albert
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/fix-quick-view-compatibility/#post-14154357)
 * Hi Albert,
    That’s great. To confirm that all the added new functionality appears
   to be working fine my end. Thanks so much!

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

The topic ‘[FIX] Quick View compatibility’ is closed to new replies.

 * ![](https://ps.w.org/phastpress/assets/icon-256x256.png?rev=1873505)
 * [PhastPress](https://wordpress.org/plugins/phastpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/phastpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/phastpress/)
 * [Active Topics](https://wordpress.org/support/plugin/phastpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/phastpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/phastpress/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [alx359](https://wordpress.org/support/users/alx359/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/fix-quick-view-compatibility/#post-14154357)
 * Status: resolved