Last active
August 29, 2015 14:02
-
-
Save scottopolis/bdde1926b1d08b0bb88f to your computer and use it in GitHub Desktop.
EDD Custom Bundle License Activation Limits
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 | |
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