Skip to content

Instantly share code, notes, and snippets.

@amdrew
Last active January 3, 2016 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amdrew/8513113 to your computer and use it in GitHub Desktop.
Save amdrew/8513113 to your computer and use it in GitHub Desktop.
Reverse the order of your variable prices in Easy Digital Downloads
<?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