This tutorial goes over the code needed to display products with variable pricing enabled. Having variable pricing enabled will allow you to have several different pricing options for a particular product. In this tutorial we will display the variable prices and a checkout button on the front-end.
Notes from the Video
- The Easy Digital Downloads documentation that goes over how to show purchase links within template files can be found here.
- Use the documentation above to customize the
sidebar-download.php
file to display the variable prices and add to cart button. This should look similar to the following:
123456789101112131415161718192021<?php/*** The sidebar containing the download sidebar widget area.** @package bootstrapwp*/?><strong>Price: <?php edd_price($post->ID); ?></strong><a href="<php bloginfo('url'); ?>/checkout?edd_action=add_to_cart&download_id=<?php echo get_the_ID(); ?>">Purchase This</a><div id="secondary" class="widget-area col-md-3 col-lg-3" role="complementary"><php echo edd_get_purchase_link( array( 'price' => FALSE, 'download_id' => $post->ID, 'class' => 'btn btn-lg btn-block btn-success', 'text' => 'Add to Cart' )); ?><?php dynamic_sidebar( 'download' ); ?></div><!-- #secondary --></div> <!-- .row --></div> <!-- .container -->