如何以编程方式更新属性前端标签?

How to update attribute frontend labels programmatically?

如何以编程方式更新属性前端标签?

 $attributeModel = \Magento\Framework\App\ObjectManager::getInstance()
        ->get(\Magento\Eav\Model\Attribute::class)->load($id);

 ...

我找到了解决方案:

$attributeModel = \Magento\Framework\App\ObjectManager::getInstance()
    ->get(\Magento\Eav\Model\Attribute::class)
    ->load($id);
  $storeLabels = $attributeModel->getStoreLabels();
  $storeLabels[$storeId] = $labelTitle;
  $attributeModel->setStoreLabels($storeLabels);

  \Magento\Framework\App\ObjectManager::getInstance()
     ->get($attributeModel->getResourceName())
     ->save($attributeModel);