Created
January 21, 2020 10:10
-
-
Save wpweb101/44954c6261bf13656e6c10de8e2dbb17 to your computer and use it in GitHub Desktop.
WooCommerce Pdf Vouchers - Function to change download button text on my account downloads listing page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter('woocommerce_customer_get_downloadable_products','woo_vou_pdf_change_download_text_on_list'); | |
| function woo_vou_pdf_change_download_text_on_list( $downloads ){ | |
| if( !empty( $downloads ) ){ | |
| $vou_download_text = get_option( 'vou_download_text' ); | |
| $vou_download_text = !empty($vou_download_text) ? $vou_download_text : esc_html__( 'Voucher Download', 'woovoucher' ); | |
| foreach ( $downloads as $key => $download) { | |
| if( isset( $download['file']) && $download['file']['name'] == $vou_download_text ){ | |
| $downloads[$key]['download_name'] = $vou_download_text; // Any name you want to show | |
| } | |
| } | |
| } | |
| return $downloads; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment