Shared Catalog is the native functionality of B2B Magento Commerce. Magento gives you the ability to maintain shared catalogs with the custom pricing structure for different companies. A Public Default(General) Catalog will be available native with Magento B2B.
You can get Shared Catalog data by shared catalog id using programmatically.
Magento\SharedCatalog\Api\SharedCatalogRepositoryInterface Interface used to get,delete and save  Shared catalog data related stuff. Get Shared Catalog data by Customer group id Magento 2.
<?php
    public function __construct(
        \Magento\SharedCatalog\Api\SharedCatalogRepositoryInterface $sharedCatalogRepository
    ) {
        $this->sharedCatalogRepository = $sharedCatalogRepository;
    }
    public function getSharedCatalog()
    {
        $sharedCatalogId = 1;
        $sharedCatalog = $this->sharedCatalogRepository->get($sharedCatalogId);
        return $sharedCatalog;
    }
Call function like,
$sharedCatalog = $this->getSharedCatalog();
echo “<pre>”;print_r($sharedCatalog->debug());exit;
You can get the result of shared catalog data by id as below,
Array
(
    [entity_id] => 1
    [name] => Default (General)
    [description] => Default shared catalog
    [customer_group_id] => 1
    [type] => 1
    [created_at] => 2019-03-05 114:25:20
    [created_by] => 1
    [store_id] => 0
    [customer_group_code] => Default (General)
    [tax_class_id] => 3
)
Result will give the info about shared catalog details like name, assigned customer group id, type is 1 for public catalog and 0 for custom catalog.

3 Replies to “Get Shared Catalog data by id programmatically Magento 2.”