How to display seller country on product thumbnail and single product page in Dokan multivendor plugin by weDevs

31 Views Asked by At

HI I'm using the Dokan Multivendor plugin from weDevs and I have a problem with custom code. Here is the code I am using but the seller's country is not displayed. Which line did I get wrong please?

I tried this code

// display seller country on product thumbnail and single product page

    add_action( 'woocommerce_after_shop_loop_item_title','country' );
    function country(){
    ?>
        </a>
        <?php
            global $product;
            $seller = get_post_field( 'post_author', $product->get_id());
 $author     = get_user_by( 'id', $seller );
            $store_info = dokan_get_store_info( $author->ID );
            if ( !empty( $store_info['store_country'] ) ) { ?>
                    <span class="details">
                        <?php printf( 'Country: <a href="%s">%s</a>', dokan_get_store_url( $author->ID ), $author->display_store_country ); ?>
                    </span>
            <?php 
        }
}

But I don't have the expected result. In place only the word country is displayed on the product only in the store without specifying the country of the seller in question (the country remains empty). And on the single product page the word country does not appear. The specific country is also empty.

Thank you in advance for your help

0

There are 0 best solutions below