• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / edd_get_download_final_price() – Retrieves the final price of a downloadable product after purchase this price includes any necessary discounts that were applied

You appear to be a bot. Output may be restricted

Description

Retrieves the final price of a downloadable product after purchase this price includes any necessary discounts that were applied

Usage

$string = edd_get_download_final_price( $download_id, $user_purchase_info, $amount_override );

Parameters

$download_id
( int ) required – ID of the download
$user_purchase_info
( array ) required – an array of all information for the payment
$amount_override
( string ) optional – a custom amount that over rides the 'edd_price' meta, used for variable prices

Returns

string the price of the download

Source

File name: easy-digital-downloads/includes/download-functions.php
Lines:

1 to 17 of 17
function edd_get_download_final_price( $download_id, $user_purchase_info, $amount_override = null ) {
  if ( is_null( $amount_override ) ) {
    $original_price = get_post_meta( $download_id, 'edd_price', true );
  } else {
    $original_price = $amount_override;
  }
  if ( isset( $user_purchase_info['discount'] ) && $user_purchase_info['discount'] != 'none' ) {
    // if the discount was a %, we modify the amount. Flat rate discounts are ignored
    if ( edd_get_discount_type( edd_get_discount_id_by_code( $user_purchase_info['discount'] ) ) != 'flat' )
      $price = edd_get_discounted_amount( $user_purchase_info['discount'], $original_price );
    else
      $price = $original_price;
  } else {
    $price = $original_price;
  }
  return apply_filters( 'edd_final_price', $price, $download_id, $user_purchase_info );
}
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 12th September 2021

Primary Sidebar

Information

Function name: edd_get_download_final_price
Plugin ref: Easy Digital Downloads
Version: 2.11.6
Sourcefile: includes/download-functions.php
File ref: includes/download-functions.php
Deprecated?: No
API Letters: D,E,F,G,P

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 6.0
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2022. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins