cancel
Showing results for 
Search instead for 
Did you mean: 

get current product attribute

get current product attribute

Can someone tell me how I can get the current product attribute so I can save it to a variable to use anywhere in my website? 

2 REPLIES 2

Re: get current product attribute

If you are saying you have the Product Object Loaded in any variable say $product, then you can get it like - 

The attribute code is custom_attribute

$product->getCustomAttribute();


Or

$product->getData('custom_attribute');

Re: get current product attribute


@gagand_magento wrote:

If you are saying you have the Product Object Loaded in any variable say $product, then you can get it like - 

The attribute code is custom_attribute

$product->getCustomAttribute();


Or

$product->getData('custom_attribute');


How could I pull in the Product Object so that I could use $product->getData('custom_attribute');