WOOT - WooCommerce Active Products Tables

Cyber Monday 2021
Cyber Monday 2021 timer

woot_extend_options

This hook allows to extend tables settings.

Example:

add_filter('woot_extend_options', 'my_woot_extend_options', 10, 2);
public function my_woot_extend_options($rows, $table_id) {
        if ($table_id > 0) {
            if (WOOT::get_table_action($table_id) === self::$action) {

                $rows[] = [
                    'id' => $table_id,
                    'title' => esc_html__('Show Sorting Dropdown', 'woot-products-tables'),
                    'value' => WOOT_HELPER::draw_switcher('is_sort_droptdown_shown', woot()->columns->options->get($table_id, 'is_sort_droptdown_shown', 0), $table_id, 'woot_save_table_option'),
                    'value_custom_field_key' => 'is_sort_droptdown_shown',
                    'notes' => esc_html__('Displays Sorting Dropdown list', 'woot-products-tables')
                ];

                $rows[] = [
                    'id' => $table_id,
                    'title' => esc_html__('Sorting Dropdown Fields', 'woot-products-tables'),
                    'value' => WOOT_HELPER::draw_select([
                        'class' => 'woot-multiple-select',
                        'multiple' => '',
                        'data-action' => 'woot_save_table_option',
                        'data-values' => woot()->columns->options->get($table_id, 'orderby_select_fields', ''),
                        'data-use-drag' => 1,
                            ], apply_filters('woot_table_orderby_select_args', self::$orderby_select_fields, $table_id), explode(',', woot()->columns->options->get($table_id, 'orderby_select_fields', ''))),
                    'value_custom_field_key' => 'orderby_select_fields',
                    'notes' => esc_html__('fields which you want to see in Sorting Dropdown fields. Press and wait to reorder.', 'woot-products-tables')
                ];

                $rows[] = [
                    'id' => $table_id,
                    'title' => esc_html__('Show shop cart', 'woot-products-tables'),
                    'value' => WOOT_HELPER::draw_switcher('is_cart_shown', woot()->columns->options->get($table_id, 'is_cart_shown', 0), $table_id, 'woot_save_table_option'),
                    'value_custom_field_key' => 'is_cart_shown',
                    'notes' => esc_html__('Displays cart as button with information, on click popup with selected products appears', 'woot-products-tables')
                ];

                $rows[] = [
                    'id' => $table_id,
                    'title' => esc_html__('Cart/Sorting positions', 'woot-products-tables'),
                    'value' => WOOT_HELPER::draw_select([
                        'data-action' => 'woot_save_table_option',
                            ], [
                        0 => esc_html__('Cart right, Sorting dropdown left', 'woot-products-tables'),
                        1 => esc_html__('Cart left, Sorting dropdown right', 'woot-products-tables'),
                            ], woot()->columns->options->get($table_id, 'cart_position', 0)),
                    'value_custom_field_key' => 'cart_position',
                    'notes' => esc_html__('On which side should be shop cart: be left or right. Sorting Dropdown will take opposite position.', 'woot-products-tables')
                ];

                $rows[] = [
                    'id' => $table_id,
                    'title' => esc_html__('After to cart adding', 'woot-products-tables'),
                    'value' => WOOT_HELPER::draw_select([
                        'data-action' => 'woot_save_table_option',
                            ], [
                        0 => esc_html__('Stay on the same page', 'woot-products-tables'),
                        1 => esc_html__('Redirect to the cart page', 'woot-products-tables'),
                        2 => esc_html__('Redirect to the checkout page', 'woot-products-tables'),
                            ], woot()->columns->options->get($table_id, 'add_to_cart_instant_redirect', 0)),
                    'value_custom_field_key' => 'add_to_cart_instant_redirect',
                    'notes' => esc_html__('Action after clicking on button Add to cart', 'woot-products-tables')
                ];

                $rows[] = [
                    'id' => $table_id,
                    'title' => esc_html__('Hide added to cart products', 'woot-products-tables'),
                    'value' => WOOT_HELPER::draw_switcher('hide_in_cart_added', woot()->columns->options->get($table_id, 'hide_in_cart_added', 0), $table_id, 'woot_save_table_option'),
                    'value_custom_field_key' => 'hide_in_cart_added',
                    'notes' => esc_html__('Do not display in the table products, which are in the cart', 'woot-products-tables')
                ];
            }
        }
        return $rows;
    }

 

See also file: \classes\tables-options.php