• Resolved kaarlomatias

    (@kaarlomatias)


    I have set up one attribute for brands and attribute terms as different brand names. Attribute term description includes image logo of the brand.

    I would like to display brand attribute term description with image below product name at single product page and category page.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi there @kaarlomatias ??

    Thank you for contacting Woo support!

    I would like to display brand attribute term description with image below product name at single product page and category page.

    Just to clarify, is the theme currently active at your site supporting attribute descriptions to show on the front end, or otherwise?

    If so, feel free to reach out to its support channel, as they would be in a better position to assist you with this.

    For a visual guide of the available hooks on the WooCommerce product page, take a look at the page linked here.

    I trust that points you in the right direction, but if you have more questions, let us know.

    We’re happy to help.

    Thread Starter kaarlomatias

    (@kaarlomatias)

    Hi, Thanks for your reply.

    There seems to be lot′s of question about this matter, but no working solution. I am currently displaying Attribute term name for brand with this code, but would like display description also.

    $brand_name = $product->get_attribute(‘brand_nc’);
    if ( ! empty($brand_name) ) {
    echo $brand_name;
    }

    Description is located at wp_term_taxonomy table, but I am having trouble displaying for brand attribute.

    Plugin Support Kaushik S. a11n

    (@kaushiksomaiya)

    Hi @kaarlomatias

    I understand you wish to pull the attribute descriptions and display them on your product pages.

    You’d want to use the wc_get_product_terms to pull all the data related to the attributes OR the wp_get_post_terms() with taxonomy slug product_attributes

    A better way is to use the WooCommerce Brands extension which provides an easy way to pull the Brand data via shortcodes or custom code. It also has a separate placeholder for brand image/thumbnail.

    Let us know if you have any questions!

    Plugin Support Kader Ibrahim S. a11n

    (@kaderibrahim)

    Hello @kaarlomatias,

    Thank you for providing us with additional context. You can use the wc_get_product_terms function to get the terms array, and then you can loop through the array to get the attribute description. For example:

    $brands = wc_get_product_terms( $product->get_id(), 'pa_brand_nc' );
    if ( is_array( $brands ) ) {
        foreach( $brands as $brand ) {
            echo $brand->description;
        }
    }

    Hope this helps. Please do not hesitate to contact us if you have more questions or need further help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display attribute term description’ is closed to new replies.