wp_create_nonce('wp_rest') ]); }); add_filter('woocommerce_loop_add_to_cart_link', [$this, 'print_button'], 10, 3); // Modal Wrapper add_action( 'wp_footer', [$this, 'qc_modal_wrapper'] ); } public function add_quick_view($list) { $product_id = Products::instance()->get_preview_product(); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Some other templates call it without nonce added. if(isset($_GET['shopengine_product_id'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Some other templates call it without nonce added. $product_id = sanitize_text_field(wp_unslash($_GET['shopengine_product_id'])); update_option('__shopengine_preview_product_id', $product_id); } elseif(get_option('__shopengine_preview_product_id')) { $product_id = get_option('__shopengine_preview_product_id'); } return array_merge($list, [ 'quick_view' => [ 'title' => esc_html__('Quick View', 'shopengine'), 'package' => 'free', 'class' => '\ShopEngine\Modules\Quick_View\Quick_View', 'opt_key' => 'quick_view', 'css' => 'quick-view', 'url' => get_permalink($product_id), ], ]); } public function qc_modal_wrapper() { ?>
'; $view = esc_html__('Quick View','shopengine'); $after = ''; // Add some text or HTML here as well. $before = " " . $eye_icon . " "; $before = apply_filters('shopengine_quick_view_button_content', $before); return $before . $add_to_cart_html . $after; } }