mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
14 lines
592 B
Text
14 lines
592 B
Text
function filter_woocommerce_customer_available_downloads( $downloads, $customer_id ) {
|
|
// Only on my account downloads section
|
|
if ( ! is_wc_endpoint_url( 'downloads' ) )
|
|
return $downloads;
|
|
|
|
// Loop though downloads
|
|
foreach( $downloads as $key => $download ) {
|
|
// Replace
|
|
$downloads[$key]['download_url'] = str_replace( '/?download_file', '/account/downloads/?download_file', $download['download_url'] );
|
|
}
|
|
|
|
return $downloads;
|
|
}
|
|
add_filter( 'woocommerce_customer_available_downloads', 'filter_woocommerce_customer_available_downloads', 10, 2 );
|