You can check the shipment comments by Magento 2 using Shipment Comment Repository Interface with shipment id.
Shipment comment repository interface used to fetch comment data of a shipment. Useful Interface is, Magento\Sales\Api\ShipmentCommentRepositoryInterface
Check the code to fetch comment by comment id,
<?php namespace Jesadiya\ShipmentComment\Model; use Magento\Sales\Api\ShipmentCommentRepositoryInterface; class ShipmentCommentByCommentId { /** * @var ShipmentCommentRepositoryInterface */ public $shipmentCommentRepository; public function __construct( ShipmentCommentRepositoryInterface $shipmentCommentRepository ) { $this->shipmentCommentRepository = $shipmentCommentRepository; } /** * Get Shipment comment data * * @return string */ public function getShipmentComment($commentId) { $comment = $this->shipmentCommentRepository->get($commentId); return $comment; } }
call method from a template or PHP class,
$commentId = 1; $this->getShipmentComment($commentId);
Pass Comment id, you need to get a comment for the shipment.
You got the response as shipment comment data.