template: bright_woocommerce_purchased_products
template: bright_woocommerce_purchased_products
This Bright shortcode can be used to show the user\'s matched courseware.
- their courseware for any order they\'ve placed and completed
- their courseware for any license key they\'ve redeemed in their account.
If not overridden shortcode is automatically rendered for a customer in the My Courses tab of their account page.
Generally, this shortcode is never used directly, as a MyCourses page automatically appears on the WooCommerce MyAccount page.
Integration With WooCommerce
Bright will create an account page for the customer at [Site URL]/my-account/my-courses/ that renders this shortcode.
Modifying What Is Displayed
How is the course list defined.
For any Bright order in a completed or wc-completed state, the associated bright products are rendered by the associated Bright template, as defined below.
What Counts as a Bright Product
A WooCommerce product is considered a Bright product when BrightWoocommerceIntegration::isBrightProduct() returns true.
In this plugin, that means any one of the following is true:
The product has one or more Bright course IDs (for example via bright_course_id metadata, including variation/function-based resolution).
The product has valid Bright product metadata (bright_metadata).
The product defines a bright_course_id_function.
The product is configured as a Bright Learning Path product (bright_learning_path_id).
If none of the above are present, the product is treated as not a Bright product.
Notes
- Bright product detection is used by My Courses and order-processing logic to determine whether course/license behavior should apply.
- Learning path products are explicitly treated as Bright products in current logic.
- Being a Bright product does not by itself guarantee display on My Courses; order status and template configuration also affect rendering.
What is a Bright Order
Any order including a Bright product (see above)
Tempate Rendering for Bright Products on Completed Orders
The Default Template
In the Admin Panel, please see
-> Bright -> WooCommerce -> Templates -> Default Product Template
You can use this define template as the default rendering for a purchased Bright-linked product on the MyAccount/MyCourses page. BRIGHT_COURSE_ID is magic and will be replaced by the product custom field bright_course_id.
If you\'ve have linked your course multiple times, the template will be rendered multiple times, one for each linked course.
If the default template is blank, the Per-Product rendering algorithm described below is used.
See also Linking A Product.
Defining Course Rendering on a Per-Product Basis
Rendering on per-product based can be done by adding a custom field to the product called bright_mycourses_template.
This field takes one of two values:
- EXCERPT : setting the field to this special variables causes the product short description to be used
- Any other data in this field is rendered as is. Bright shortcodes and/or templates are permitted [as well as any other shortcodes active on your site].
No Template Found
If no default template is set, and no configuration is found on the product, an error message will appear that indicates that product configuration is not setup correctly.
An error similar to This e-learning product's setup has not been completed [no default template] and cannot be displayed. Please contact your site's administrator. will appear.
Products Not Found Or In Draft State
If we discover an order including Bright products in the draft state, a warning will appear to the user that the product is no longer available.
An error similar to A product you previously purchased (${COURSE NAME}) is no longer available and was not displayed. will appear.
Debugging
This shortcode will respond to a Query Parameter debug that will display a table showing the orders and/or license keys that are included in the rendered courses.
Also note that debugging tables are available in the Javascript Console/developer tools:

Adding Custom Content Before Or After The Display Products/Courses
Two action hooks are available:
- bright_before_purchased_products_shortcode
- bright_after_purchased_products_shortcode
that can be used to add custom content before or after the purchased products or courses rendered by this shortcode.
add_action('bright_after_purchased_products_shortcode', function() {
echo '<div>My Custom Content</div>';
});







