Use $_product object instead of undefined $product_id for downloadable permissions. Fixes #4095
This commit is contained in:
parent
f7c3362e8a
commit
8a45886a4c
|
@ -116,7 +116,7 @@ function woocommerce_downloadable_product_permissions( $order_id ) {
|
|||
$_product = $order->get_product_from_item( $item );
|
||||
|
||||
if ( $_product && $_product->exists() && $_product->is_downloadable() ) {
|
||||
$downloads = get_post_meta( $product_id, '_downloadable_files' ) ;
|
||||
$downloads = get_post_meta( $_product->id, '_downloadable_files' ) ;
|
||||
|
||||
foreach ( $downloads[0] as $download_id => $download )
|
||||
woocommerce_downloadable_file_permission( $download_id, $item['variation_id'] > 0 ? $item['variation_id'] : $item['product_id'], $order );
|
||||
|
|
Loading…
Reference in New Issue