WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How can WooCommerce handle links to online training videos? (7 posts)

  1. Nick Wingfield
    Member
    Posted 2 years ago #

    I've installed WooCommerce.

    I want to set up a WordPress / WooCommerce site where customers pay to see online training videos but I'm not sure how to go about it? Ideally, once customers have paid via Paypal, they'll get a link to view the movie they've chosen. Returning customers will be able to click on 'My account' and see easy links to all the movies they've purchased before.

    Is this something that can be done with WooCommerce or with an extra WooCommerce extension?

    Here's the test I've done with just one movie so far. It almost works! Please let me know if there is a better way?

    I uploaded a movie to YouTube set as 'unlisted'. Then I placed the YouTube code on a WordPress page. I used a plugin called 'Exclude Pages from Navigation' to hide the page. Then I created a WooCommerce Product page. My hope was that I could place a link to the hidden WordPress/YouTube page that customers would see once they'd paid. Unfortunately, when I put the link in the 'Purchase Note' section - it shows but can't be clicked on. Customer could copy and paste - but that's not as good. Then I tried 'File path'. Unfortunately this only seems to work for downloadable items - not just as a link. Otherwise, this would be ideal because the download links appear in a list on the 'My Account' page just as I wanted.

    So that's where I am. So near but yet so far. Any suggestions will be gratefully received.

  2. elinthorsthoman
    Member
    Posted 1 year ago #

    Hi Nick,

    I have the same issue, and trying to achieve the exact same with training video's. Did you manage to find a solution for this?
    Where can I find the Purchase note section?

  3. Nick Wingfield
    Member
    Posted 1 year ago #

    Hi elinthorsthoman

    I'd forgotten I'd solved this:

    On Product Page:
    Product Data - Simple Product. Virtual.
    Click on Product Data to reveal tabs.
    Fill in tabs as required.
    Then in the Advanced tab:
    Purchase Note:
    <a href="zzz">View video</a>
    (Replace zzz with html link to your video page)

  4. elinthorsthoman
    Member
    Posted 1 year ago #

    Thanks so much! Very clear!

  5. elinthorsthoman
    Member
    Posted 1 year ago #

    Hi Nick,

    I have changed the my account page to show the description of the product and to show the video upon completion of the payment. I think this might be good for you as well. (I got rid off the shipped to field)

    Here is the full code of the my-account.php file for copy/paste:

    <?php
    /**
     * My Orders
     *
     * Shows recent orders on the account page
     *
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     1.6.4
     */
    
    global $woocommerce;
    
    $customer_id = get_current_user_id();
    
    $args = array(
        'numberposts'     => $recent_orders,
        'meta_key'        => '_customer_user',
        'meta_value'	  => $customer_id,
        'post_type'       => 'shop_order',
        'post_status'     => 'publish'
    );
    $customer_orders = get_posts($args);
    
    if ($customer_orders) :
    ?>
    	<table class="shop_table my_account_orders">
    
    		<thead>
    			<tr>
    				<th class="order-number"><span class="nobr"><?php _e('Order', 'woocommerce'); ?></span></th>
    				<th class="order-date"><span class="nobr"><?php _e('Datum', 'woocommerce'); ?></span></th>
    				<th class="product-name"><span class="nobr"><?php _e('Product', 'woocommerce'); ?></span></th>
    				<th class="product-purchase-note"><span class="nobr"><?php _e('Video', 'woocommerce'); ?></span></th>
    				<th class="order-total"><span class="nobr"><?php _e('Total', 'woocommerce'); ?></span></th>
    				<th class="order-status" colspan="2"><span class="nobr"><?php _e('Status', 'woocommerce'); ?></span></th>
    			</tr>
    		</thead>
    
    		<tbody><?php
    			foreach ($customer_orders as $customer_order) :
    				$order = new WC_Order();
    
    				$order->populate( $customer_order );
    
    				$status = get_term_by('slug', $order->status, 'shop_order_status');
    
    				?><tr class="order">
    					<td class="order-number" width="1%">
    						<a href="<?php echo esc_url( add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))) ); ?>"><?php echo $order->get_order_number(); ?></a>;
    					</td>
    					<td class="order-date"><time title="<?php echo esc_attr( strtotime($order->order_date) ); ?>"><?php echo date_i18n(get_option('date_format'), strtotime($order->order_date)); ?></time></td>
    
    <?php
    		if (sizeof($order->get_items())>0) :
    
    			foreach($order->get_items() as $item) :
    
    				if (isset($item['variation_id']) && $item['variation_id'] > 0) :
    					$_product = new WC_Product_Variation( $item['variation_id'] );
    				else :
    					$_product = new WC_Product( $item['id'] );
    				endif;
    
    				echo '
    
    						<td class="product-name">';
    
    				echo '' . $item['name'] . '';
    
    				$item_meta = new WC_Order_Item_Meta( $item['item_meta'] );
    				$item_meta->display();
    
    				if ( $_product->exists() && $_product->is_downloadable() && $_product->has_file() && ( $order->status=='completed' || ( get_option( 'woocommerce_downloads_grant_access_after_payment' ) == 'yes' && $order->status == 'processing' ) ) ) :
    
    					echo '<br/><small><a href="' . $order->get_downloadable_file_url( $item['id'], $item['variation_id'] ) . '">' . __('Download file &rarr;', 'woocommerce') . '</a></small>';
    
    				endif;
    
    				// Show any purchase notes
    				if ($order->status=='completed' || $order->status=='processing') :
    					if ($purchase_note = get_post_meta( $_product->id, '_purchase_note', true)) :
    						echo '<td class="product-purchase-note">' . apply_filters('the_content', $purchase_note) . '</td>';
    					endif;
    				endif;
    
    			endforeach;
    		endif;
    
    		do_action( 'woocommerce_order_items_table', $order );
    		?>
    
    <td class="order-total" width="1%"><?php echo $order->get_formatted_order_total(); ?></td>
    					<td></td><td class="order-status" style="text-align:left; white-space:nowrap;">
    						<?php echo ucfirst( __( $status->name, 'woocommerce' ) ); ?>
    						<?php if (in_array($order->status, array('pending', 'failed'))) : ?>
    							<a href="<?php echo esc_url( $order->get_cancel_order_url() ); ?>" class="cancel" title="<?php _e('Click to cancel this order', 'woocommerce'); ?>">(<?php _e('Cancel', 'woocommerce'); ?>)</a>
    						<?php endif; ?>
    					</td>
    					<td class="order-actions" style="text-align:right; white-space:nowrap;">
    
    						<?php if (in_array($order->status, array('pending', 'failed'))) : ?>
    							<a href="<?php echo esc_url( $order->get_checkout_payment_url() ); ?>" class="button pay"><?php _e('Pay', 'woocommerce'); ?></a>
    						<?php endif; ?>
    
    						<a href="<?php echo esc_url( add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))) ); ?>" class="button"><?php _e('View', 'woocommerce'); ?></a>
    
    					</td>
    				</tr><?php
    			endforeach;
    		?></tbody>
    
    	</table>
    <?php
    else :
    ?>
    	<p><?php _e('You have no recent orders.', 'woocommerce'); ?></p>
    <?php
    endif;
    ?>
  6. Nick Wingfield
    Member
    Posted 1 year ago #

    Thanks elinthorsthoman

    That's very kind of you. I'll try it out

  7. elinthorsthoman
    Member
    Posted 1 year ago #

    I am not a coding expert but it seems to be working for now.. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.