Add category to the Vendor's block

I want to add the listing category to the vendor’s block and i used this code snippet

add_filter(
	'hivepress/v1/templates/vendor_view_block/blocks',
	function($blocks, $template){
		$vendor = $template->get_context('vendor');
		
		if(!$vendor || !$vendor->get_categories()){
			return $blocks;
		}
		
		$output = '';
		
		foreach ( $vendor->get_categories() as $category ){
			$output .= '<span>'.esc_html( $category->get_name() ).'</span>';
		}
	
		return hivepress()->helper->merge_trees(
			[ 'blocks' => $blocks ],
			[
				'blocks' => [
					'vendor_content' => [
						'blocks' => [
							'custom_vendor_categories' => [
								'type'   => 'content',
								'content'  => $output,
								'_order' => 21,
							],
						],
					],
				],
			]
		)['blocks'];
	},
	1000,
	2
);

but the listing category made the vendor block longer than expected. see image to see the outcome Screenshot by Lightshot you can see beauty

Now i want the listing category to appear at the place the number of listings are in this image Screenshot by Lightshot at the bottom of the vendor’s block next to the message button, where you can see 3 lisitings. this will make the vendor block normal instead if making it longer

Hi,

Unfortunately, in the vendor block, there is no way to get a listing category because a vendor can have many listings, but you can get a vendor category, please try this PHP snippet:

add_filter(
 'hivepress/v1/templates/vendor_view_block/blocks',
 function($blocks, $template){
  $vendor = $template->get_context('vendor');
  
  if(!$vendor || !$vendor->get_categories()){
   return $blocks;
  }
  
  $output = '';
  
  foreach ( $vendor->get_categories() as $category ){
   $output .= '<span>'.esc_html( $category->get_name() ).'</span>';
  }
 
  return hivepress()->helper->merge_trees(
   [ 'blocks' => $blocks ],
   [
    'blocks' => [
     'vendor_footer' => [
      'blocks' => [
       'custom_vendor_categories' => [
        'type'   => 'content',
        'content'  => $output,
        '_order' => 21,
       ],
      ],
     ],
    ],
   ]
  )['blocks'];
 },
 1000,
 2
);

Please note that it can require further customization.