No products pages and take the course problem

Home Forums Legacy Support Support queries How-to & Troubleshooting No products pages and take the course problem

Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #231754
    StudioLeBus
    Participant
    Hello,  I would like to not showing any product page, I found it confusing for customers... so I wanted that the button "take the course" redirects directly to check out ... I checked the Skip product & cart option in the miscenalleous section of wplms setting, so the "take the course" button should redirect to the checkout page... but now in the cart or in some places there is still the link to the products so I used this code in this topic : https://wplms.io/support/forums/topic/redirect-product-page-to-course-page/   So I use this code in the function.php file of my child theme... add_action('template_redirect','custom_redirect_to_course_page_from_product_page',1); function custom_redirect_to_course_page_from_product_page(){ global $post; if( get_post_type($post->ID) != 'product' || !is_singular('product') ){ return; } $courses = get_post_meta($post->ID,'vibe_courses',true); if( !empty($courses) && is_array($courses) ){ foreach ($courses as $course_id) { wp_redirect( get_permalink($course_id) ); exit(); } }else{ wp_redirect( home_url() ); exit(); } } but there's a problem now : When I can't click on "take the course" on the course page, it redirects to the product which... directly redirect to the course ! can I change the link "Take the course" to go directly to the checkout ? I can see in the URL there's /product/productname/?redirect so the product goes now back to the course... Any ideas to help ?? thanks in advance
    #231808
    Veronica
    Moderator
    hi, please share the credentials in private reply. I will check it.
    #232177
    StudioLeBus
    Participant
    Hello Thanks I managed to change all link in cart and mini cart to redirect to the courses, and to redirect the products shop page to the courses page.. so It's ok I think now ! :)   thanks
    #232289
    logan
    Member
    thanks for confirming. topic closed.
Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘No products pages and take the course problem’ is closed to new replies.