We created a plugin and now we want to get selected fields only on the response, to minimize the response payload.
We are aware that criteria "includes" will help based on the URL https://developer.shopware.com/docs/guides/integrations-api/general-concepts/search-criteria
In the Array of $criteria we can see what "includes" is added like filter but does not give the selected fields
Please help what I am doing wrong?
EXample
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
$Criteria = new Criteria();
$Criteria->addFilter(new EqualsFilter('id', $productId));
$Criteria->setIncludes(array('product-alias' => array('name')));
$productRepo = $this->productRepository->search($Criteria, $context);
I have tried
$Criteria->setIncludes(array('product' => array('name')));
$Criteria->setIncludes(array('name'));