$categoryId = $this->getLayer()->getCurrentCategory()->getId();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get(\Magento\Store\Model\StoreManagerInterface::class);
$currentstore = $storeManager->getStore()->getCode();
$categorysFactory = $objectManager->get('\Magento\Catalog\Model\CategoryFactory');
//$categoryId = 4; // YOUR CATEGORY ID
$category = $categorysFactory->create()->load($categoryId);
$collection = $category->getProductCollection()
->addAttributeToSelect('*');
}