Magento 2: Fetch availability date using dynamic variable

Viewed 9

i am using 3rd party module that allow to use the Dynamic Variable to fetch data from magento to push into feed.

This is the code i am working on to get availability date from magento products but it is not returning any date.

$availability_dates = [];
foreach ($product->getAvailabilityDate() ?: [] as $availability_date) {
$availability_dates[] = $availability_date->getDate();
}
echo implode(', ', $availability_dates);

here is another working code that does fetch the categories associated with products

$categories = [];
foreach ($product->getCategoryCollection()->addNameToResult() as $category) {
$categories[] = $category->getName();
}
echo implode('|', $categories);
0 Answers
Related