WC_API_Products::get_downloads()
Get the downloads for a product or product variation
Метод класса: WC_API_Products{}
Хуков нет.
Возвращает
Массив
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_downloads( $product );
- $product(WC_Product|WC_Product_Variation) (обязательный)
- -
Список изменений
С версии 2.1 | Введена. |
Код WC_API_Products::get_downloads() WC API Products::get downloads WC 8.1.1
private function get_downloads( $product ) { $downloads = array(); if ( $product->is_downloadable() ) { foreach ( $product->get_downloads() as $file_id => $file ) { $downloads[] = array( 'id' => $file_id, // do not cast as int as this is a hash 'name' => $file['name'], 'file' => $file['file'], ); } } return $downloads; }