Skip to content

Instantly share code, notes, and snippets.

@scottopolis
Last active August 29, 2015 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scottopolis/bdde1926b1d08b0bb88f to your computer and use it in GitHub Desktop.
Save scottopolis/bdde1926b1d08b0bb88f to your computer and use it in GitHub Desktop.
EDD Custom Bundle License Activation Limits
<?php
function sb_edd_filter_license_limit( $limit, $download_id, $license_id, $price_id ) {
$payment_id = get_post_meta( $license_id, '_edd_sl_payment_id', true );
$is_bundle = false;
$bundle_items = array();
$downloads = edd_get_payment_meta_downloads( $payment_id );
if( $downloads ) {
foreach( $downloads as $download ) {
if( 'bundle' == edd_get_download_type( $download['id'] ) && 6013 == $download['id'] ) {
$is_bundle = true;
$bundle_items = edd_get_bundled_products( $download['id'] );
break;
}
}
}
if( $is_bundle && in_array( $download_id, $bundle_items ) ) {
return 25;
}
return $limit;
}
add_filter( 'edd_get_license_limit', 'sb_edd_filter_license_limit', 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment