Using Action Hooks and Filters in Upsells for LearnDash
Using Action Hooks and Filters in Upsells for LearnDash
If you wish to extend or customize the Upsells for LearnDash plugin’s functionality, you can use the following action hooks and filters. These hooks allow developers to inject custom content or modify output dynamically, ensuring flexibility across different themes and layouts.
ldups_after_course_price
This hook helps you display custom content after the course price. You can use it to add discount information, promotional tags, or call-to-action links.
Hook:
do_action( 'ldups_after_course_price', int $course_id );
Parameter: $course_id (int) — The ID of the current course.
Description: Use this action to inject dynamic messages or additional elements below the course price in the Upsells widget.
Example:
add_filter('asdld_modify_comment_reply_email_content', 'customize_comment_reply_email', 10, 2);
function customize_comment_reply_email($message, $comment) {
// Modify the email body
$message .= "\n\nThank you for your feedback, " . $comment->comment_author . "!";
return $message;
}
Filters
ldups_course_currency_change
This filter lets you change the currency symbol displayed before the course price. It’s especially useful if you want to display a different currency symbol or format prices dynamically based on user location or settings.
Filter:
apply_filters( 'ldups_course_currency_change', string $currency, int $course_id );
Parameters:
$currency (string) — Current currency symbol used before the price.
$course_id (int) — The ID of the current course.
Description:
Use this filter to override the default currency symbol or modify it programmatically before rendering the price.
Example:
/**
* Example usage for ldups_course_currency_change.
*/
add_filter(
'ldups_course_currency_change',
function( $currency, $course_id ) {
// Replace with your custom currency symbol or logic.
return '$'; // Example: Force USD symbol
},
10,
2
);
ldups_course_currency_change
This filter lets you change the currency symbol displayed before the course price. It’s especially useful if you want to display a different currency symbol or format prices dynamically based on user location or settings.
Filter:
apply_filters( 'ldups_course_currency_change', string $currency, int $course_id );
Parameters:
$currency (string) — Current currency symbol used before the price.
$course_id (int) — The ID of the current course.
Description:
Use this filter to override the default currency symbol or modify it programmatically before rendering the price.
Example:
/**
* Example usage for ldups_course_currency_change.
*/
add_filter(
'ldups_course_currency_change',
function( $currency, $course_id ) {
// Replace with your custom currency symbol or logic.
return '$'; // Example: Force USD symbol
},
10,
2
);