In this blog, I will explain how can you get if an product attribute value is overridden for a store view. Here for example I am checking for Product Name (product_name) attribute and store view with id=1.
public function __construct( ..... \Magento\Catalog\Model\Attribute\ScopeOverriddenValue $scopeOverriddenValue ) { ..... $this->scopeOverriddenValue = $scopeOverriddenValue; } public function execute() { ..... $isOverriden = $this->scopeOverriddenValue->containsValue( \Magento\Catalog\Api\Data\ProductInterface::class, $product, //Product object 'product_name', //Attribute Name 1 //Store view Id ); }
It will result True if the “Use Default Value” is unchecked. So for below it will result,
Otherwise it will return False, like below,
Feel free to comment if you find any issue.