- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2020
08:45 AM
01-16-2020
08:45 AM
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?
Labels:
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2020
02:18 AM
01-17-2020
02:18 AM
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');
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2020
05:26 AM
01-17-2020
05:26 AM
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');