Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cklosowski/09492ad45281b64b54a8e0c1dfdca83e to your computer and use it in GitHub Desktop.
Save cklosowski/09492ad45281b64b54a8e0c1dfdca83e to your computer and use it in GitHub Desktop.
Integrating with the Easy Digital Downloads variable price advanced options in version 2.8
<?php
/**
* Custom section for EDD price options
*/
function eddwp_custom_price_option_section( $post_id, $key, $args ) {
$recurring = EDD_Recurring()->is_price_recurring( $post_id, $key );
?>
<div class="edd-custom-price-option-section">
<span class="edd-custom-price-option-section-title">My Sample Extension</span>
<div class="edd-custom-price-option-section-content">
<span>
<label for="edd_variable_prices[<?php echo $key; ?>][recurring]">My Sample Setting</label>
<select name="edd_variable_prices[<?php echo $key; ?>][recurring]" id="edd_variable_prices[<?php echo $key; ?>][recurring]">
<option value="no" <?php selected( $recurring, false ); ?>><?php echo esc_attr_e( 'No', 'edd-recurring' ); ?></option>
<option value="yes" <?php selected( $recurring, true ); ?>><?php echo esc_attr_e( 'Yes', 'edd-recurring' ); ?></option>
</select>
</span>
</div>
</div>
<?php
}
add_action( 'edd_download_price_option_row', 'eddwp_custom_price_option_section', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment