Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WC_API_Products::get_downloads( WC_Product|WC_Product_Variation $product )
Get the downloads for a product or product variation
Description Description
Parameters Parameters
- $product
-
(Required)
Return Return
(array)
Source Source
File: includes/legacy/api/v2/class-wc-api-products.php
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; }
Changelog Changelog
Version | Description |
---|---|
2.1 | Introduced. |