downloads.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Downloads
  4. *
  5. * Shows downloads on the account page.
  6. *
  7. * This template can be overridden by copying it to yourtheme/woocommerce/myaccount/downloads.php.
  8. *
  9. * HOWEVER, on occasion WooCommerce will need to update template files and you
  10. * (the theme developer) will need to copy the new files to your theme to
  11. * maintain compatibility. We try to do this as little as possible, but it does
  12. * happen. When this occurs the version of the template file will be bumped and
  13. * the readme will list any important changes.
  14. *
  15. * @see https://docs.woocommerce.com/document/template-structure/
  16. * @author WooThemes
  17. * @package WooCommerce/Templates
  18. * @version 3.2.0
  19. */
  20. if ( ! defined( 'ABSPATH' ) ) {
  21. exit;
  22. }
  23. $downloads = WC()->customer->get_downloadable_products();
  24. $has_downloads = (bool) $downloads;
  25. do_action( 'woocommerce_before_account_downloads', $has_downloads ); ?>
  26. <?php if ( $has_downloads ) : ?>
  27. <?php do_action( 'woocommerce_before_available_downloads' ); ?>
  28. <?php do_action( 'woocommerce_available_downloads', $downloads ); ?>
  29. <?php do_action( 'woocommerce_after_available_downloads' ); ?>
  30. <?php else : ?>
  31. <div class="woocommerce-Message woocommerce-Message--info woocommerce-info">
  32. <a class="woocommerce-Button button" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
  33. <?php esc_html_e( 'Go shop', 'woocommerce' ) ?>
  34. </a>
  35. <?php esc_html_e( 'No downloads available yet.', 'woocommerce' ); ?>
  36. </div>
  37. <?php endif; ?>
  38. <?php do_action( 'woocommerce_after_account_downloads', $has_downloads ); ?>