Skip to content

Instantly share code, notes, and snippets.

@amdrew
Last active December 28, 2015 20:29
Show Gist options
  • Select an option

  • Save amdrew/7557921 to your computer and use it in GitHub Desktop.

Select an option

Save amdrew/7557921 to your computer and use it in GitHub Desktop.
Change the purchase button text and append the price in Easy Digital Downloads
<?php
function edd_custom_edd_checkout_button_purchase() {
global $edd_options;
$color = isset( $edd_options[ 'checkout_color' ] ) ? $edd_options[ 'checkout_color' ] : 'gray';
$color = ( $color == 'inherit' ) ? '' : $color;
$style = isset( $edd_options[ 'button_style' ] ) ? $edd_options[ 'button_style' ] : 'button';
$button_label = 'Pay ' . edd_currency_filter( edd_format_amount( edd_get_cart_total() ) );
ob_start();
?>
<input type="submit" class="edd-submit <?php echo $color; ?> <?php echo $style; ?>" id="edd-purchase-button" name="edd-purchase" value="<?php echo $button_label; ?>"/>
<?php
return ob_get_clean();
}
add_filter( 'edd_checkout_button_purchase', 'edd_custom_edd_checkout_button_purchase' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment