• Resolved niikk

    (@niikk)


    Hello,

    We know, that we can display the vendor shop name with this code below. But how can we display the vendor logo? I guess we can reuse that code with different properties?

    Original code from: https://nayemdevs.com/display-vendor-name/

    Cheers

    add_action( 'woocommerce_single_product_summary','sold_by_store_name', 5 );
        function sold_by_store_name(){
        ?>
            </a>
            <?php
                global $product;
                $seller = get_post_field( 'post_author', $product->get_id());
                $author  = get_user_by( 'id', $seller );
                $vendor = dokan()->vendor->get( $seller );
    
                $store_info = dokan_get_store_info( $author->ID );
                if ( !empty( $store_info['store_name'] ) ) { ?>
                        <span class="SellerDetailsProductSinglePageLable">
                            <?php printf( '<a>%s</a>', $vendor->get_shop_name() ); ?>
                        </span>
                <?php 
            } 
    
        }
    • This topic was modified 3 years, 4 months ago by niikk.
    • This topic was modified 3 years, 4 months ago by niikk.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Jahidul Hassan Mojumder

    (@jahidulhassan)

    Hi @niikk

    As far I have understood, you want to add the vendor’s profile picture to the single product page then you can absolutely use this code till now. You will need to add the below-mentioned code to your functions.php file.
    <img src="<?php echo esc_url( $vendor->get_avatar() ) ?>" alt="<?php echo esc_attr( $vendor->get_shop_name() ) ?>"width="50" height="50">
    After adding that, the output will be something like https://snipboard.io/MDensJ.jpg this. I hope this will help.

    This code produce fatal error after adding it to my theme function.php
    Is there any other method or code i can use ?

    Plugin Support Jahidul Hassan Mojumder

    (@jahidulhassan)

    Hi @metalsunny

    As far as I am concerned, the line of code that I have shared has nothing that can throw a fatal error on your site. Would you mind sharing a snippet of the code so that I can have a look at under which function of your functions.php you have added the code?

    Pls see screenshot of insert via code snippet https://prnt.sc/1s0o64k
    Error https://prnt.sc/1s0o7fn

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display Vendor Logo on product page’ is closed to new replies.