<?php
function add_attribute($option){

    $attributes = array();
    if ( class_exists( 'WooCommerce' ) ) {
        $attribute_taxonomies = wc_get_attribute_taxonomies();
        $attributes = array();
        foreach($attribute_taxonomies as $attr)
        {
            if($attr->attribute_type == 'select')
            {
                $key = 'pa_'.$attr->attribute_name;
                $attributes[$key] = $attr->attribute_label;
            }
        }
    }

    $option['nbcore_pa_swatch_intro']= array(
        'settings' => array(),
        'controls' => array(
            'label' => esc_html__('Swatch style Attributes', 'furone'),
            'section' => 'product_category',
            'type' => 'Furone_Customize_Control_Heading',
        ),
    );

    $option['nbcore_wc_attr']= array(
        'settings' => array(
            'default' => true,
            'sanitize_callback' => array('Furone_Customize_Sanitize', 'sanitize_checkbox')
        ),
        'controls' => array(
            'label' => esc_html__('Show Attribute ?', 'furone'),
            'description' => esc_html__('This options also effect for product attributes in product archive', 'furone'),
            'section' => 'product_category',
            'type' => 'Furone_Customize_Control_Switch',
        ),
    );

    $option['nbcore_pa_swatch_style' ]= array(
        'settings' => array('sanitize_callback' => '',),
        'controls' => array(
            'label' => esc_html__('Swatch style Attributes', 'furone'),
            'description' => esc_html__('This options also effect for product attributes', 'furone'),
            'section' => 'product_category',
            'type' => 'Furone_Customize_Control_Checkbox_List',
            'choices' => $attributes,
            'condition' => array(
                'element' => 'nbcore_wc_attr',
                'value'   => 1,
            )
        ),
    );
    return $option;
}
add_filter('attribute_hook','add_attribute');