Last active
January 3, 2016 20:09
-
-
Save amdrew/8513113 to your computer and use it in GitHub Desktop.
Reverse the order of your variable prices in Easy Digital Downloads
This file contains 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 | |
// reverse the order of the variable prices | |
function sumobi_edd_purchase_variable_prices( $variable_prices, $download_id ) { | |
krsort( $variable_prices ); | |
return $variable_prices; | |
} | |
add_filter( 'edd_purchase_variable_prices', 'sumobi_edd_purchase_variable_prices', 10, 2 ); | |
// Make the first item checked again | |
function sumobi_edd_price_option_checked( $checked, $download_id, $key ) { | |
$prices = edd_get_variable_prices( $download_id ); | |
end( $prices ); | |
$checked = key( $prices ); | |
return $checked; | |
} | |
add_filter( 'edd_price_option_checked', 'sumobi_edd_price_option_checked', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment