• Resolved wptech

    (@wptech)


    Hi,

    I am using LLMS version 3.1.6 and developing a theme. I have spent a lot of time to find out that how to show a course price. I have tried various ways to retrieve the course access plans but all in vain. The developer documentation is incomplete. Can you please guide me to retrieve the prices.

    Thanks

Viewing 1 replies (of 1 total)
  • @wptech,

    You can programmatically access access plans like so:

    
    <?php
    $product = new LLMS_Product( 123 ); // use the ID of your course or membership here
    $plans = $product->get_access_plans();
    if ( $plans ) {
    	foreach ( $plans as $plan ) {
    		echo echo $plan->get_price( 'price' );
    	}
    }
    

    You are correct that the developer documentation is incomplete. My excuse is that the entire codebase is painstakingly documented using inline docblocks and it’s not too difficult to find what you need by searching for what you’re looking for on GitHub.

    Take a look at the product model: https://github.com/gocodebox/lifterlms/blob/master/includes/models/model.llms.product.php

    The access plan model: https://github.com/gocodebox/lifterlms/blob/master/includes/models/model.llms.access.plan.php

    And the core template for the pricing tables which can serve as an example for how we use the access plan model in the core: https://github.com/gocodebox/lifterlms/blob/master/templates/product/pricing-table.php

    I’m stoked you’re working on a theme. If it’s something you’ll be offering either for sale or free in mass please get in touch with us at lifterlms.com/contact — we’d love to help promote your release when it’s ready and I’m always looking to get feedback from theme devs to help us make LifterLMS better for ya’ll.

    Reminder: this is a support forum and we don’t take feedback or feature requests here! Mostly because I’m spread really thin and the forums are an imperfect mechanism for communication.

    Thanks,

Viewing 1 replies (of 1 total)
  • The topic ‘How to Get price of Course Access Plan’ is closed to new replies.