• Thank you for your great support!

    Thank you for making discount table as an dropdown tab.
    Here is the snippet code for it:

    if (!function_exists('awdr_discount_table_product_tab_content')) {
        function awdr_discount_table_product_tab_content() {
            global $product;
            do_action('advanced_woo_discount_rules_load_discount_table', $product);
        }
    }
    add_action('advanced_woo_discount_rules_after_initialize', function () {
        if (class_exists('\Wdr\App\Router')) {
            $manage_discount = \Wdr\App\Router::$manage_discount;
            $show_bulk_table = $manage_discount::$config->getConfig('show_bulk_table', 0);
            $position_to_show_bulk_table = $manage_discount::$config->getConfig('position_to_show_bulk_table', 'woocommerce_before_add_to_cart_form');
            if (!empty($show_bulk_table) && isset($position_to_show_bulk_table) && !empty($position_to_show_bulk_table)) {
    		remove_action($position_to_show_bulk_table, array($manage_discount, 'showBulkTableInPosition')); 
    			
                add_filter('woocommerce_product_tabs', function ($tabs) {
                    $tabs['test_tab'] = array(
                        'title'     => __('Discount table', 'woo-discount-rules'),
                        'priority'     => 50,
                        'callback'     => 'awdr_discount_table_product_tab_content'
                    );
                    return $tabs;
                });
            }
        }
    });

    And I added little extra for the dropdown not opening automatically, so this is the code for Custom JS (On document ready Will be executed on $(document).ready()) :

    setTimeout(function() {
        var $tabs = jQuery( '.wc-tabs, ul.tabs' ).first();
        $tabs.parent().find('#tab-test_tab').hide();
        $tabs.parent().find( '.tab-title-test_tab' ).removeClass('active');
    }, 1)
    jQuery(document).ready(function(){
    	jQuery('body').addClass('ready');
    });

    Thank you! ??

    • This topic was modified 2 years, 3 months ago by tuomonurkkala.
  • The topic ‘Great support! Discount table tab’ is closed to new replies.