Home › Forums › Legacy Support › Support queries › Other issues › Redirect to course page from product page
- This topic has 5 replies, 4 voices, and was last updated 3 years, 10 months ago by Anshuman Sahu.
-
AuthorPosts
-
May 21, 2020 at 3:54 am #261350stevenheongSpectatorHi support team, I followed the instruction here and problem happened: https://wplms.io/support/forums/topic/redirect-product-page-to-course-page/
the code did work for redirecting the product page to course page, when clicking the product link both in the cart page and my order page
however, after adding the code, the take this course in the course page will be not working, and only reload the page only. Therefore, students can not add the course to the cart and subscribe to the course.
May 21, 2020 at 11:03 am #261521VeronicaModeratorhi, please provide the exact information according to your site. like product page url to which you want to redirect it and course page url on which you want to redirect it i will try to take a lookJune 4, 2020 at 11:21 am #265753ICHARSSpectatorI am facing a similar issue, so instead of creating another thread I am just sharing the steps to recreate the problem:- Create a course (A) and add a woocommerce product (A) to the same
Now you will notice that there is a Course Page (A) and also a Product Page (A). On the course page (A) when you click the take this course button, it works perfectly.
Now redirect Product Page (A) to Course Page (A) using any redirection plugin or code in htaccess file or the code mentioned on https://wplms.io/support/forums/topic/redirect-product-page-to-course-page/
Now try visiting the Product Page (A), it will redirect to Course Page (A). So the redirection works perfectly but on the Course Page (A) now the take this course button no longer works.
Kindly suggest. If you would like me to create another thread do let me know, but it is the exact same issue that the thread creator and I seem to be facing.
June 5, 2020 at 1:30 pm #266118Anshuman SahuKeymasterPlease set wp-admin -> wplms -> miscellaneous -> direct checkout -> skip product page . This will remove the user from going to product page clicking on product link in the cart .June 5, 2020 at 10:13 pm #266190ICHARSSpectatorSkipping the product page and going directly to checkout page works perfectly but that is not the problem that I am referring to. I am not sure if you understand what we are trying to do. Maybe I have not been able to explain this clearly so let me try to go step by step. Current Behaviour: When a course is created that has a woocommerce product associated to it, there are two pages that get created on the website.- Course Page
Woocommerce Product Page
The wocommerce product page really does not contain any useful data as the complete course information is on the course page. Desired Behaviour: If a user visits the product page I would like to redirect them back to the course page. My initial thoughts were that any redirection plugin in wordpress or a simple 301 redirect from product page to course age should do the trick. The problem is when a 301 redirect is done from the product page to course page, the take this course button on the course page stops functioning. To recreate the issue, kindly follow the steps mentioned here
June 6, 2020 at 12:35 pm #266355Anshuman SahuKeymasterYes the redirection with .htaccess will make the direct checkout to stop working . I got the issue now . remove your .htaccess redirection and please try adding this given code in your wplms-customizer.php file in wplms customizer plugin : add_Action('woocommerce_before_single_product',function(){ $courses = get_post_meta(get_the_ID(),'vibe_courses',true); if(!empty($courses) && count($courses)){ echo ' <meta http-equiv="refresh" content="0;URL=\''.get_permalink($courses[0]).'\'" />'; } }); -
AuthorPosts
- The topic ‘Redirect to course page from product page’ is closed to new replies.