Home Forums WoodMart support forum double field for “Show product brands next to title”, “Brand attribute”

double field for “Show product brands next to title”, “Brand attribute”

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #382871

    loralora
    Participant

    Hello

    I ask you for help.
    I have 2 attributes: Man Collection, Woman Collection.

    1. I need to display these two attributes under the product name on archive pages.
    2. Display these two attributes on the single product page.

    those If the Product is in the “men’s collection” – display only these values
    If the Product is in the “women’s collection” – display only these values.

    My friend has either the “Men’s Collection” attribute or the “Men’s Collection” attribute.

    Right now I was only able to show for “Women’s Collection” – I used “Show product brands next to title” and “Brand attribute and Show brand on the single product page and Brand position on the product page – on the right”.

    my question is: How to display the same values ​​for the attribute “Men’s collection” for products that have this attribute?

    Is there a custom code for this? for example, to make an additional double field for the second brand attribute and display the value for the “Men’s collection”? Can you share the code?

    Thanks a lot

    #382950

    Hello,

    Sorry but there is no option in Theme Settings available for that.

    It requires customizations and this is beyond our limitations and support policy.

    Best Regards

    #383040

    loralora
    Participant

    very sorry to hear that

    In any case, I need a hook from you to output my attribute at this location. See screenshot

    Attachments:
    You must be logged in to view attached files.
    #383049

    loralora
    Participant

    Maybe you have a code how to display a certain attribute?

    for example, if a product has the “pa_size_plus” attribute, then display its values as links to all products with this attribute value (for example, how do you implement this with “brands”?

    I would then add it to “woocommerce_after_shop_loop_item_title” and your hook, which you would indicate to me at the request above, because I’m already exhausted., especially since I see that you help some users with a short code

    Thanks

    #383054

    loralora
    Participant

    I found the code, and it seems to output what I need.

    I have 2 questions for you:
    1. share the hook from the question above (to add exactly where the brands.
    2. please tell me how to display not just a value, but a link to the attribute value? look at my code…

    add_action('woocommerce_after_shop_loop_item_title', 'display_shop_loop_product_attributes', 5);
    function display_shop_loop_product_attributes() {
        global $product;
    
        // Define you product attribute taxonomies in the array
        $product_attribute_taxonomies = array( 'pa_size_plus' );
        $attr_output = array(); // Initializing
    
        // Loop through your defined product attribute taxonomies
        foreach( $product_attribute_taxonomies as $taxonomy ){
            if( taxonomy_exists($taxonomy) ){
                $label_name = wc_attribute_label( $taxonomy, $product );
    
                $term_names = $product->get_attribute( $taxonomy );
    
                if( ! empty($term_names) ){
                    $attr_output[] = '<span class="'.$taxonomy.'"> '.$term_names.'</span>';
                }
            }
        }
    
        // Output
        echo '<div class="wd-product-brands-links woodmart-product-brands-links">'.implode( '<br>', $attr_output ).'</div>';
    }
    #383162

    Hello,

    Sorry but we could not help with third party code snippets. This is out of our theme support scope.

    Best Regards

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