includes/cli/class-wc-cli-product.php 1 location
|
@@ 986-1003 (lines=18) @@
|
| 983 |
|
* @param WC_Product|WC_Product_Variation $product |
| 984 |
|
* @return array |
| 985 |
|
*/ |
| 986 |
|
private function get_downloads( $product ) { |
| 987 |
|
|
| 988 |
|
$downloads = array(); |
| 989 |
|
|
| 990 |
|
if ( $product->is_downloadable() ) { |
| 991 |
|
|
| 992 |
|
foreach ( $product->get_files() as $file_id => $file ) { |
| 993 |
|
|
| 994 |
|
$downloads[] = array( |
| 995 |
|
'id' => $file_id, // do not cast as int as this is a hash |
| 996 |
|
'name' => $file['name'], |
| 997 |
|
'file' => $file['file'], |
| 998 |
|
); |
| 999 |
|
} |
| 1000 |
|
} |
| 1001 |
|
|
| 1002 |
|
return $downloads; |
| 1003 |
|
} |
| 1004 |
|
|
| 1005 |
|
/** |
| 1006 |
|
* Get an individual variation's data |
includes/api/class-wc-rest-products-controller.php 1 location
|
@@ 211-225 (lines=15) @@
|
| 208 |
|
* @param WC_Product|WC_Product_Variation $product |
| 209 |
|
* @return array |
| 210 |
|
*/ |
| 211 |
|
protected function get_downloads( $product ) { |
| 212 |
|
$downloads = array(); |
| 213 |
|
|
| 214 |
|
if ( $product->is_downloadable() ) { |
| 215 |
|
foreach ( $product->get_files() as $file_id => $file ) { |
| 216 |
|
$downloads[] = array( |
| 217 |
|
'id' => $file_id, // MD5 hash. |
| 218 |
|
'name' => $file['name'], |
| 219 |
|
'file' => $file['file'], |
| 220 |
|
); |
| 221 |
|
} |
| 222 |
|
} |
| 223 |
|
|
| 224 |
|
return $downloads; |
| 225 |
|
} |
| 226 |
|
|
| 227 |
|
/** |
| 228 |
|
* Get taxonomy terms. |