Home Forums Basel – Premium Template Hierarchical attributes / parent attributes

This topic contains 1 reply, has 2 voices, and was last updated by Elise Noromit Elise Noromit 1 week, 2 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #241917

    nikosvl97
    Customer

    hello, i added html block with product filters and i saw that the Hierarchical attributes not working, i reenabled it with this function

    if( function_exists( 'WC' ) ){
        add_action( 'init', 'yith_woocommerce_register_taxonomies_hack', 4 );
    
        if( ! function_exists( 'yith_woocommerce_register_taxonomies_hack' ) ){
            function yith_woocommerce_register_taxonomies_hack(){
                if( $attribute_taxonomies = wc_get_attribute_taxonomies() ) {
                    foreach ($attribute_taxonomies as $tax) {
                        if ($name = wc_attribute_taxonomy_name($tax->attribute_name)) {
                            add_filter( "woocommerce_taxonomy_args_{$name}", 'yith_woocommerce_taxonomy_product_attribute_args' );
                        }
                    }
                }
            }
        }
    
        if( ! function_exists( 'yith_woocommerce_taxonomy_product_attribute_args' ) ){
            function yith_woocommerce_taxonomy_product_attribute_args( $taxonomy_data ){
                $taxonomy_data['hierarchical'] = true;
                return $taxonomy_data;
            }
        }
    }

    but now i want to show only the parent attributes on my shop page. i need it for the size and the colors. (pa_color, pa_size) is that possible ?

    Private Content Hidden
    #242098

    Hello,

    Please remove your custom code and follow this instruction: https://xtemos.com/docs/basel/attribute-swatches/

    If you want to add filters to the shop page sidebar, add BASEL WooCommerce Layered Nav widget to the shop page widget area in Appearance > Widgets.

    Best Regards

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.