0

I have created a custom product attribute using data patch in my custom module and it is visible in product configuration in admin, also when I save value in it, it get save to catalog_product_entity_int table, now I want to get its value in custom model but its not accessible. I tried like:

$product->getEnableSubscription() //enable_subscription is attribute name
$product->getData('enable_subscription')

I added attribute in product backend only and want to fetch its value saved from admin panel.

11
  • 1
    I think this one answer might be helpful for you magento.stackexchange.com/questions/356938/… Aug 5 at 9:28
  • @VictorTihonchuk thanks for sharing. After adding catalog_attributes.xml file I can see my custom attribute using getData() function but it is not accessible using product object. Aug 5 at 16:34
  • Its nested insides many arrays/object, can't get like $product->getEnableSubscription() Aug 5 at 16:35
  • 1
    1. $quote->getAllItems() returns quote item object (not product). 2. I guess the similar case with configurable options. You didn't specify place when you try to check Aug 5 at 20:27
  • 1
    If you properly specify your second attribute and properly flushed cache - it should work. You should receive it value (not label). Aug 5 at 20:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.