Created
July 30, 2019 11:16
-
-
Save SashkoWooTeam/ba41dcc670269065949f2e371a58be64 to your computer and use it in GitHub Desktop.
JetSmartFilters compatibility with Wholesale Pro
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
| add_action( 'jet-smart-filters/provider/epro-archive-products/before-ajax-content', 'theme_name_jet_smart_filters_compatibility' ); | |
| function theme_name_jet_smart_filters_compatibility() { | |
| if ( class_exists( 'IGN_Wholesale_Pro_Suite' ) ) { | |
| $settings = get_option( 'woocommerce_ignitewoo_wholesale_pro_suite_settings' ); | |
| if ( ! empty( $settings['login_required_for_prices'] ) && 'yes' == $settings['login_required_for_prices'] && ! is_user_logged_in() ) { | |
| if ( wp_doing_ajax() ) { | |
| add_filter( 'woocommerce_get_price_html', 'theme_name_replace_price_html', 999999, 2 ); | |
| add_filter( 'woocommerce_is_purchasable', 'theme_name_disable_purchaseable', 999999, 2 ); | |
| add_filter( 'woocommerce_loop_add_to_cart_link', 'theme_name_remove_add_to_cart_button', 999999, 2 ); | |
| } | |
| } | |
| } | |
| } | |
| function theme_name_replace_price_html( $price ) { | |
| $settings = get_option( 'woocommerce_ignitewoo_wholesale_pro_suite_settings' ); | |
| if ( function_exists( 'is_product' ) && is_product() ) | |
| $class = 'alt'; | |
| else | |
| $class = ''; | |
| if ( 'nothing' == $settings['price_alt_type'] ) { | |
| return false; | |
| } else if ( 'link' == $settings['price_alt_type'] && !empty( $settings['price_alt_link'] ) && !empty( $settings['price_alt_text'] ) ) { | |
| return '<a href="' . $settings['price_alt_link'] . '" class="wsp_link">' . $settings['price_alt_text'] . '</a>'; | |
| } else if ( 'button' == $settings['price_alt_type'] && !empty( $settings['price_alt_link'] ) && !empty( $settings['price_alt_text'] ) ) { | |
| return '<a href="' . $settings['price_alt_link'] . '" class="button wsp_button ' . $class . '">' . $settings['price_alt_text'] . '</a>'; | |
| } else if ( 'text' == $settings['price_alt_type'] && !empty( $settings['price_alt_text'] ) ) { | |
| return '<span class="login_to_see_prices wsp_text">' . $settings['price_alt_text'] . '</span>'; | |
| } | |
| return false; | |
| } | |
| function theme_name_disable_purchaseable( $purchaseable ) { | |
| return false; | |
| } | |
| function theme_name_remove_add_to_cart_button( $button, $product ) { | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment