ID ) ? $post->ID : 0; $product = wc_get_product( $post_id ); $shop_cart_show_cross_sell = get_theme_mod( 'shop_cart_show_cross_sell', 1 ); $has_related_products = is_singular( 'product' ) && get_theme_mod( 'single_related_products', 1 ) && ! empty( wc_get_related_products( $post_id ) ) ? true : false; $has_recently_viewed_products = is_singular( 'product' ) && get_theme_mod( 'single_recently_viewed_products', 0 ) ? true : false; $has_upsell_products = is_singular( 'product' ) && get_theme_mod( 'single_upsell_products', 1 ) && $product->get_upsell_ids() ? true : false; if ( is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy() || botiga_page_has_woo_blocks() || is_cart() || is_404() || $shop_cart_show_cross_sell || $has_related_products || $has_recently_viewed_products || $has_upsell_products || is_search() && $has_search_popular_products ) { botiga_quick_view_needed_scripts(); } } add_action( 'wp_enqueue_scripts', 'botiga_quick_view_scripts', 11 ); /** * Function to enqueue needed quick view scripts * We need this function alone because it is also used to enqueue scripts inside gutenberg and elementor blocks (without any condition check) * */ function botiga_quick_view_needed_scripts() { $register_scripts = array(); if ( current_theme_supports( 'wc-product-gallery-slider' ) ) { $register_scripts['flexslider'] = array( 'src' => plugins_url( 'assets/js/flexslider/jquery.flexslider.min.js', WC_PLUGIN_FILE ), 'deps' => array( 'jquery' ), ); } if ( current_theme_supports( 'wc-product-gallery-lightbox' ) ) { $register_styles = array( 'photoswipe' => array( 'src' => plugins_url( 'assets/css/photoswipe/photoswipe.min.css', WC_PLUGIN_FILE ), 'deps' => array(), ), 'photoswipe-default-skin' => array( 'src' => plugins_url( 'assets/css/photoswipe/default-skin/default-skin.min.css', WC_PLUGIN_FILE ), 'deps' => array( 'photoswipe' ), ), ); foreach ( $register_styles as $name => $props ) { wp_enqueue_style( $name, $props['src'], $props['deps'], BOTIGA_VERSION ); } $register_scripts['photoswipe'] = array( 'src' => plugins_url( 'assets/js/photoswipe/photoswipe.min.js', WC_PLUGIN_FILE ), 'deps' => array(), ); $register_scripts['photoswipe-ui-default'] = array( 'src' => plugins_url( 'assets/js/photoswipe/photoswipe-ui-default.min.js', WC_PLUGIN_FILE ), 'deps' => array( 'photoswipe' ), ); } $register_scripts['wc-single-product'] = array( 'src' => plugins_url( 'assets/js/frontend/single-product.min.js', WC_PLUGIN_FILE ), 'deps' => array( 'jquery' ), ); if ( current_theme_supports( 'wc-product-gallery-zoom' ) ) { $register_scripts['zoom'] = array( 'src' => plugins_url( 'assets/js/zoom/jquery.zoom.min.js', WC_PLUGIN_FILE ), 'deps' => array( 'jquery' ), ); } // Enqueue variation scripts. $register_scripts['wc-add-to-cart-variation'] = array( 'src' => plugins_url( 'assets/js/frontend/add-to-cart-variation.min.js', WC_PLUGIN_FILE ), 'deps' => array( 'jquery', 'wp-util', 'jquery-blockui' ), ); $register_scripts['botiga-quick-view'] = array( 'src' => get_template_directory_uri() . '/assets/js/botiga-quick-view.min.js', 'deps' => array( 'jquery' ), ); // Enqueue scripts. foreach ( $register_scripts as $name => $props ) { wp_enqueue_script( $name, $props['src'], $props['deps'], BOTIGA_VERSION, true ); } // Enqueue styles. wp_enqueue_style( 'botiga-quick-view', get_template_directory_uri() . '/assets/css/quick-view.min.css', array(), BOTIGA_VERSION ); } /** * Quick view button * * @param bool $product_id * @param bool $do_echo * @param string $block_layout Layout from gutenberg and elementor blocks. * * @return string */ function botiga_quick_view_button( $product = false, $do_echo = true, $block_layout = 'layout1' ) { if( $product == false ) { global $product; } $product_id = $product->get_id(); $quick_view_layout = get_theme_mod( 'shop_product_quickview_layout', 'layout1' ); if( 'layout1' === $quick_view_layout ) { if( 'layout1' === $block_layout ) { return ''; } } if( $do_echo === false ) { ob_start(); } ?>
absint( $_POST['product_id'] ), ); botiga_get_template_part( 'template-parts/content', 'quick-view', $args ); wp_die(); } add_action( 'wp_ajax_botiga_quick_view_content', 'botiga_quick_view_content_callback_function' ); add_action( 'wp_ajax_nopriv_botiga_quick_view_content', 'botiga_quick_view_content_callback_function' ); /** * Quick View Summary Title * * @param object $product * * @return void */ function botiga_quick_view_summary_title( $product = null ) { ?>get_price_html(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
get_short_description() ); if ( $short_description ) : ?>get_price_html(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>