/** * YITH Plugins support * * @return string * @since 1.0 */ function yit_plugins_support() { /* === YITH WooCommerce Multi Vendor */ if (class_exists('YITH_Vendors_Frontend_Premium') && function_exists('YITH_Vendors')) { $obj = YITH_Vendors()->frontend; remove_action('woocommerce_archive_description', array($obj, 'add_store_page_header')); add_action('yith_before_shop_page_meta', array($obj, 'add_store_page_header')); add_filter('yith_wpv_quick_info_button_class', 'yith_multi_vendor_button_class'); add_filter('yith_wpv_report_abuse_button_class', 'yith_multi_vendor_button_class'); } if (!function_exists('yith_multi_vendor_quick_info_button_class')) { /** * YITH Plugins support -> Multi Vendor widgets submit button * * @param string $class * @return string * @since 1.0 */ function yith_multi_vendor_button_class($class) { return 'button btn-flat pull-right'; } } /* === YITH WooCommerce Advanced Review */ if (defined('YITH_YWAR_VERSION')) { global $YWAR_AdvancedReview; remove_action('yith_advanced_reviews_before_reviews', array($YWAR_AdvancedReview, 'load_reviews_summary')); add_action('yith_advanced_reviews_before_review_list', array($YWAR_AdvancedReview, 'load_reviews_summary')); } if (defined('YITH_YWAR_PREMIUM')) { add_filter('yith_advanced_reviews_loader_gif', 'yit_loading_search_icon'); } /* Request a Quote */ if (defined('YITH_YWRAQ_VERSION')) { $yith_request_quote = YITH_Request_Quote(); if (method_exists($yith_request_quote, 'add_button_shop')) { remove_action('woocommerce_after_shop_loop_item', array($yith_request_quote, 'add_button_shop'), 15); add_action('woocommerce_before_shop_loop_item', array($yith_request_quote, 'add_button_shop'), 30); } add_filter('ywraq_product_in_list', 'yit_ywraq_change_product_in_list_message'); function yit_ywraq_change_product_in_list_message() { return __('In your quote list', 'yit'); } add_filter('ywraq_product_added_view_browse_list', 'yit_ywraq_product_added_view_browse_list_message'); function yit_ywraq_product_added_view_browse_list_message() { return __('View list >', 'yit'); } add_filter('yith_admin_tab_params', 'yith_wraq_remove_layout_options'); if (!function_exists('yith_wraq_remove_layout_options')) { /** * Remove Layout option from Request a Quote * * @param array $array * @return array * @since 1.0 */ function yith_wraq_remove_layout_options($array) { if ($array['page'] == 'yith_woocommerce_request_a_quote') { unset($array['available_tabs']['layout']); } return $array; } } } /*================ Colors and Label Variations Premium ==================*/ if (defined('YITH_WCCL_PREMIUM') && function_exists('YITH_WCCL_Frontend')) { remove_filter('woocommerce_loop_add_to_cart_link', array(YITH_WCCL_Frontend(), 'add_select_options'), 99, 2); add_action('woocommerce_after_shop_loop_item_title', array(YITH_WCCL_Frontend(), 'print_select_options'), 99); if (yit_get_option('shop-layout-type') == 'slideup') { add_filter('yith_wccl_add_to_cart_button_content', 'yit_get_add_to_cart_slideup'); } function yit_get_add_to_cart_slideup($arg) { $img = yit_get_option('shop-slide-add-cart-icon') != '' ? yit_get_option('shop-slide-add-cart-icon') : get_template_directory_uri() . '/images/ico-cart.png'; $image_size = yit_getimagesize($img); $button = '<img src="' . $img . '" alt="ico-cart" class="ico-cart" height="' . $image_size[1] . '" width="' . $image_size[0] . '"/>'; return $button; } } /* === WPML === */ function yit_wpml_endpoint_hack_for_after() { global $yit_wpml_hack_endpoint; $yit_wpml_hack_endpoint = WC()->query->query_vars; // add the options foreach ($yit_wpml_hack_endpoint as $endpoint => $value) { add_option('woocommerce_myaccount_' . $endpoint . '_endpoint', $value); } } add_action('after_setup_theme', 'yit_wpml_endpoint_hack_for_after', 11); function yit_wpml_my_account_endpoint() { global $woocommerce_wpml, $yit_wpml_hack_endpoint; if (!isset($woocommerce_wpml->endpoints)) { return; } $endpoints = array('recent-downloads', 'myaccount-wishlist'); $wc_vars = WC()->query->query_vars; foreach ($endpoints as $endpoint) { if (!isset($yit_wpml_hack_endpoint[$endpoint])) { return; } $wc_vars_endpoint = isset($wc_vars[$endpoint]) ? $wc_vars[$endpoint] : $endpoint; WC()->query->query_vars[$endpoint] = $woocommerce_wpml->endpoints->get_endpoint_translation($yit_wpml_hack_endpoint[$endpoint], $wc_vars_endpoint); } unset($yit_wpml_hack_endpoint); } add_action('init', 'yit_wpml_my_account_endpoint', 3); }
/** * YITH Plugins support * * @return string * @since 1.0 */ function yit_plugins_support(){ /* === YITH WooCommerce Multi Vendor */ if( class_exists( 'YITH_Vendors_Frontend_Premium' ) && function_exists( 'YITH_Vendors' ) ){ $obj = YITH_Vendors()->frontend; remove_action( 'woocommerce_archive_description', array( $obj, 'add_store_page_header' ) ); add_action( 'yith_before_shop_page_meta', array( $obj, 'add_store_page_header' ) ); add_filter( 'yith_wpv_quick_info_button_class', 'yith_multi_vendor_button_class' ); add_filter( 'yith_wpv_report_abuse_button_class', 'yith_multi_vendor_button_class' ); } if ( ! function_exists( 'yith_multi_vendor_quick_info_button_class' ) ) { /** * YITH Plugins support -> Multi Vendor widgets submit button * * @param string $class * @return string * @since 1.0 */ function yith_multi_vendor_button_class( $class ) { return 'btn btn-flat alignright'; } } /* === YITH WooCommerce Advanced Review */ if ( defined( 'YITH_YWAR_PREMIUM' ) ) { add_filter( 'yith_advanced_reviews_loader_gif', 'yit_loading_search_icon' ); } /* Request a Quote */ if ( defined( 'YITH_YWRAQ_VERSION' ) ) { $yith_request_quote = YITH_Request_Quote(); if ( method_exists( $yith_request_quote, 'add_button_shop' ) ) { remove_action( 'woocommerce_after_shop_loop_item', array( $yith_request_quote, 'add_button_shop' ), 15 ); add_action( 'woocommerce_after_shop_loop_item_title', array( $yith_request_quote, 'add_button_shop' ), 30); } add_filter( 'ywraq_product_in_list', 'yit_ywraq_change_product_in_list_message' ); function yit_ywraq_change_product_in_list_message() { return __( 'In your quote list', 'yit' ); } add_filter( 'ywraq_product_added_view_browse_list', 'yit_ywraq_product_added_view_browse_list_message' ); function yit_ywraq_product_added_view_browse_list_message() { return __( 'View list >', 'yit' ); } add_filter( 'yith_admin_tab_params' , 'yith_wraq_remove_layout_options' ); if ( ! function_exists( 'yith_wraq_remove_layout_options' ) ) { /** * Remove Layout option from Request a Quote * * @param array $array * @return array * @since 1.0 */ function yith_wraq_remove_layout_options( $array ) { if ( $array['page'] == 'yith_woocommerce_request_a_quote' ) { unset( $array['available_tabs']['layout'] ); } return $array; } } } // Catalog Mode if ( defined( 'YWCTM_PREMIUM' ) ) { global $YITH_WC_Catalog_Mode; remove_action( 'woocommerce_before_shop_loop_item_title', array( $YITH_WC_Catalog_Mode, 'hide_add_to_cart_loop' ), 5 ); add_action( 'woocommerce_before_shop_loop_item_title', 'yit_rg_hide_add_to_cart_loop', 10 ); } function yit_rg_hide_add_to_cart_loop() { global $YITH_WC_Catalog_Mode; if ( isset( $YITH_WC_Catalog_Mode ) ) { if ( method_exists( $YITH_WC_Catalog_Mode, 'check_hide_add_cart_loop' ) ) { global $woocommerce_loop; if ( ! isset( $woocommerce_loop['products_layout'] ) || $woocommerce_loop['products_layout'] == 'elegant' || $woocommerce_loop['products_layout'] == 'default' ) { if ( $YITH_WC_Catalog_Mode->check_hide_add_cart_loop() ) { remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_add_to_cart', 20 ); } else { add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_add_to_cart', 20 ); } } else { if ( $woocommerce_loop['products_layout'] == 'alternative' ) { if ( $YITH_WC_Catalog_Mode->check_hide_add_cart_loop() ) { remove_action( 'woocommerce_before_shop_loop_item_title', 'yit_shop_loop_add_to_cart', 20 ); } else { add_action( 'woocommerce_before_shop_loop_item_title', 'yit_shop_loop_add_to_cart', 20 ); } } } } } } /*================ Colors and Label Variations Premium ==================*/ if( defined( 'YITH_WCCL_PREMIUM' ) && function_exists( 'YITH_WCCL_Frontend' ) ) { remove_filter( 'woocommerce_loop_add_to_cart_link', array( YITH_WCCL_Frontend(), 'add_select_options' ), 99, 2 ); add_action( 'woocommerce_after_shop_loop_item_title', array( YITH_WCCL_Frontend(), 'print_select_options' ) , 50); } /* === WPML === */ function yit_wpml_endpoint_hack_for_after() { global $yit_wpml_hack_endpoint; $yit_wpml_hack_endpoint = WC()->query->query_vars; // add the options foreach ( $yit_wpml_hack_endpoint as $endpoint => $value ) { add_option( 'woocommerce_myaccount_'.$endpoint.'_endpoint', $value ); } } add_action( 'after_setup_theme', 'yit_wpml_endpoint_hack_for_after', 11 ); function yit_wpml_my_account_endpoint() { global $woocommerce_wpml, $yit_wpml_hack_endpoint; if ( ! isset( $woocommerce_wpml->endpoints ) ) { return; } $endpoints = array( 'recent-downloads', 'myaccount-wishlist', ); $wc_vars = WC()->query->query_vars; foreach ( $endpoints as $endpoint ) { if ( ! isset( $yit_wpml_hack_endpoint[ $endpoint ] ) ) { return; } $wc_vars_endpoint = isset( $wc_vars[ $endpoint ] ) ? $wc_vars[ $endpoint ] : $endpoint; WC()->query->query_vars[$endpoint] = $woocommerce_wpml->endpoints->get_endpoint_translation( $yit_wpml_hack_endpoint[$endpoint] , $wc_vars_endpoint ); } unset( $yit_wpml_hack_endpoint ); } add_action( 'init', 'yit_wpml_my_account_endpoint', 3 ); }