Menu

How to redirect all of your buy buttons to an external checkout

 

If you would like to customize the link on the "Buy" buttons for your course landing pages, you can do that with a quick change to your theme HTML. Below you'll find instructions for replacing the default link across all of your courses and some instructions for replacing the link for each individual course. 


Replacing the default link on all of your course landing pages


1. Go to Themes > Manage My Themes on your admin dashboard and select to "Edit HTML/CSS" for your theme.

 

2. In your theme, navigate to Snippets > course_action_buttons and find the following lines:


      {% if course.user_can_purchase %}

        {% include "button" link: course.links.buy, button_type: "primary", text: course.buy_button_text %}

      {% endif %}


3. You'll need to replace the part highlighted in yellow above with your chosen link in quotation marks, as shown below:




4. Save your changes by clicking on File > Save Changes. 


And that's it! Your new "Buy" button link will be reflected on your course landing pages. 


Replacing the link on each individual course landing page. 


1. Go to Themes > Manage My Themes on your admin dashboard and select to "Edit HTML/CSS" for your theme.


2. In your theme, navigate to Snippets > course_action_buttons and find the following lines:


      {% if course.user_can_purchase %}

        {% include "button" link: course.links.buy, button_type: "primary", text: course.buy_button_text %}

      {% endif %}


3. Find the course id for your course by looking at the URL in the course builder:




4. You'll need to add a conditional statement into your code to target each specific course. I've highlighted that in yellow below:


      {% if course.user_can_purchase %}

        {% if course.id == 139512 %}

          {% include "button" link: course.links.buy, button_type: "primary", text: course.buy_button_text %}

        {% else %}

          {% include "button" link: course.links.buy, button_type: "primary", text: course.buy_button_text %}

        {% endif %}

      {% endif %}


I cut and paste the original button code and placed that inside my conditional statement. From there, I will change the link to the link of my external checkout just like in the instructions above. Remember to use quotation marks! 


      {% if course.user_can_purchase %}

        {% if course.id == 139512 %}

          {% include "button" link:"http://my_checkout_page.com/course139512", button_type: "primary", text: course.buy_button_text %}

        {% else %}

          {% include "button" link: course.links.buy, button_type: "primary", text: course.buy_button_text %}

        {% endif %}

      {% endif %}


If I want to add another course, I continue my conditional statement using the {% elsif %} tag.


      {% if course.user_can_purchase %}

        {% if course.id == 139512 %}

          {% include "button" link:"http://my_checkout_page.com/course139512", button_type: "primary", text: course.buy_button_text %}

        {% elsif course.id == 435485 %}

          {% include "button" link:"http://my_checkout_page.com/course435485", button_type: "primary", text: course.buy_button_text %}

        {% else %}

          {% include "button" link: course.links.buy, button_type: "primary", text: course.buy_button_text %}

        {% endif %}

      {% endif %}


Each additional course gets an {% elsif %} tag until you get to the end of all of your courses, where you will use {% else %} to define the default behaviour for pages that don't meet your {% if %} condition. 


5. Save your changes by clicking on File > Save Changes. 


And you're done! Don't forget to make a note of the changes you've made in case you need to make an update to your Theme, as this customization will not carry over. 




1 person has this question