Home › Forums › WoodMart support forum › how to can i add categories and tags in compare table.. › Reply To: how to can i add categories and tags in compare table..
weedgeneral
hi thanks for reply could you tell me how i can register categories and tags in child theme..
/**
* All available fields for Theme Settings sorter option.
*
* @param bool $new New option.
*
* @return array
*/
public function compare_available_fields( $new = false ) {
$product_attributes = array();
if ( function_exists( ‘wc_get_attribute_taxonomies’ ) ) {
$product_attributes = wc_get_attribute_taxonomies();
}
if ( $new ) {
$options = array(
‘description’ => array(
‘name’ => esc_html__( ‘Description’, ‘woodmart’ ),
‘value’ => ‘description’,
),
‘dimensions’ => array(
‘name’ => esc_html__( ‘Dimensions’, ‘woodmart’ ),
‘value’ => ‘dimensions’,
),
‘weight’ => array(
‘name’ => esc_html__( ‘Weight’, ‘woodmart’ ),
‘value’ => ‘weight’,
),
‘availability’ => array(
‘name’ => esc_html__( ‘Availability’, ‘woodmart’ ),
‘value’ => ‘availability’,
),
‘sku’ => array(
‘name’ => esc_html__( ‘Sku’, ‘woodmart’ ),
‘value’ => ‘sku’,
),
);
if ( count( $product_attributes ) > 0 ) {
foreach ( $product_attributes as $attribute ) {
$options[ ‘pa_’ . $attribute->attribute_name ] = array(
‘name’ => wc_attribute_label( $attribute->attribute_label ),
‘value’ => ‘pa_’ . $attribute->attribute_name,
);
}
}
return $options;
}
$fields = array(
‘enabled’ => array(
‘description’ => esc_html__( ‘Description’, ‘woodmart’ ),
‘sku’ => esc_html__( ‘Sku’, ‘woodmart’ ),
‘availability’ => esc_html__( ‘Availability’, ‘woodmart’ ),
),
‘disabled’ => array(
‘weight’ => esc_html__( ‘Weight’, ‘woodmart’ ),
‘dimensions’ => esc_html__( ‘Dimensions’, ‘woodmart’ ),
),
);
if ( count( $product_attributes ) > 0 ) {
foreach ( $product_attributes as $attribute ) {
$fields[‘disabled’][ ‘pa_’ . $attribute->attribute_name ] = $attribute->attribute_label;
}
}
return $fields;
}