Skip to content

Instantly share code, notes, and snippets.

@yojance
Created August 10, 2015 19:19
Show Gist options
  • Save yojance/362a30d35c26f5ca7d3a to your computer and use it in GitHub Desktop.
Save yojance/362a30d35c26f5ca7d3a to your computer and use it in GitHub Desktop.
$protection_engine = new MM_ProtectedContentEngine();
$attached_bundle = $protection_engine->getPostAccessRights( $course_id );
$bundle_id = $attached_bundle[0]->access_id;
$bundle = new MM_Bundle( $bundle_id );
$associated_product_id = key( $bundle->getAssociatedProducts() );
$associated_product = new MM_Product( $associated_product_id );
$buy_link = add_query_arg( array( 'rid' => $associated_product->getReferenceKey() ), home_url( '/' ) . 'checkout/' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment