public get_downloads ( string $context = 'view' ) : array | ||
$context | string | |
return | array |
public function get_downloads($context = 'view')
{
return $this->get_prop('downloads', $context);
}
/** * Get the downloads for a product or product variation * * @since 2.1 * @param WC_Product|WC_Product_Variation $product * @return array */ private function get_downloads($product) { $downloads = array(); if ($product->is_downloadable()) { foreach ($product->get_downloads() as $file_id => $file) { $downloads[] = array('id' => $file_id, 'name' => $file['name'], 'file' => $file['file']); } } return $downloads; }