diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py index 05279fe8cd..e507826920 100644 --- a/common/djangoapps/student/views/dashboard.py +++ b/common/djangoapps/student/views/dashboard.py @@ -22,6 +22,7 @@ from opaque_keys.edx.keys import CourseKey from openedx_filters.learning.filters import DashboardRenderStarted from pytz import UTC +from edx_django_utils.plugins import pluggable_override from lms.djangoapps.bulk_email.api import is_bulk_email_feature_enabled from lms.djangoapps.bulk_email.models import Optout from common.djangoapps.course_modes.models import CourseMode @@ -323,6 +324,14 @@ def reverification_info(statuses): return reverifications +@pluggable_override('OVERRIDE_GET_CREDIT_BUTTON_HREF') +def get_credit_button_href(course_key): + """ + Get the credit button URL for a course. + """ + return f"{settings.ECOMMERCE_PUBLIC_URL_ROOT}/credit/checkout/{course_key}/" + + def credit_statuses(user, course_enrollments): """ Retrieve the status for credit courses. @@ -423,6 +432,7 @@ def credit_statuses(user, course_enrollments): "provider_id": None, "request_status": request_status_by_course.get(course_key), "error": False, + "credit_btn_href": get_credit_button_href(str(course_key)), } # If the user has purchased credit, then include information about the credit diff --git a/lms/templates/dashboard/_dashboard_credit_info.html b/lms/templates/dashboard/_dashboard_credit_info.html index 2f13f6e734..418acc403c 100644 --- a/lms/templates/dashboard/_dashboard_credit_info.html +++ b/lms/templates/dashboard/_dashboard_credit_info.html @@ -24,10 +24,7 @@ credit_msg_class = "credit-eligibility-msg" credit_btn_class = "purchase-credit-btn" credit_btn_label = _("Get Credit") - ecommerce_url_root = static.get_value('ECOMMERCE_PUBLIC_URL_ROOT', settings.ECOMMERCE_PUBLIC_URL_ROOT) - credit_btn_href = '{root}/credit/checkout/{course_id}/'.format( - root=ecommerce_url_root, - course_id=credit_status['course_key']) + credit_btn_href = credit_status['credit_btn_href'] if credit_status["purchased"]: request_status = credit_status["request_status"]