Skip to content

Instantly share code, notes, and snippets.

@kreamweb
Created August 4, 2021 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kreamweb/99a74d7196279917086720a310e452df to your computer and use it in GitHub Desktop.
Save kreamweb/99a74d7196279917086720a310e452df to your computer and use it in GitHub Desktop.
<?php
if ( function_exists( 'YITH_WC_Subscription_Frontend' ) ) {
add_filter( 'woocommerce_customer_get_downloadable_products', 'woocommerce_order_get_downloadable_items_ywsbs_helper' );
function woocommerce_order_get_downloadable_items_ywsbs_helper( $downloads ) {
if ( ! is_account_page() ) {
return $downloads;
}
$used = array();
$singles = array();
foreach ( $downloads AS $key => $line ) {
if ( !in_array($line['download_id'], $used) ) {
$used[] = $line['download_id'];
$singles[] = $line;
}
}
return $singles;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment