Last active
May 18, 2020 16:05
-
-
Save wpbean/dd5def3fe91c9b42c9c3c0890a80a3ba to your computer and use it in GitHub Desktop.
WooCommerce QuickView LightBox Plugin PRO add Quick View for a category only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://wpbean.com/downloads/woocommerce-lightbox-pro/ | |
/* | |
Add the following Code on your theme/child-theme functions.php file. Replace the id 64 with your category ID | |
*/ | |
add_action( 'woocommerce_after_shop_loop_item', 'wpb_wl_add_quick_view_button_for_categories' ); | |
function wpb_wl_add_quick_view_button_for_categories(){ | |
if( has_term(64, 'product_cat') && function_exists('wpb_wl_hook_quickview_link')){ | |
wpb_wl_hook_quickview_link( get_the_id() ); | |
} | |
} | |
/* | |
For multiple categories add the following Code on your theme/child-theme functions.php file. Replace the ids with your category IDs | |
*/ | |
add_action( 'woocommerce_after_shop_loop_item', 'wpb_wl_add_quick_view_button_for_categories' ); | |
function wpb_wl_add_quick_view_button_for_categories(){ | |
if( has_term(array(64,75, 80), 'product_cat') && function_exists('wpb_wl_hook_quickview_link')){ | |
wpb_wl_hook_quickview_link( get_the_id() ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment