adding add to cart button on course featured block.

Please add the given code in your wplms-customizer.php file in wplms customizer :

add_filter('wplms_course_thumb_extras','add_add_to_cart_link_course_block');

function add_add_to_cart_link_course_block($html){

  global $post;

  $product=get_post_meta($post->ID,'vibe_product',true);

  if( !empty($product) && is_array( $product)){

    foreach( $product as $p){

      $html.=do_shortcode('[add_to_cart id="'.$p.'"]');

    }

  }elseif(!empty($product) ){

     $html.=do_shortcode('[add_to_cart id="'.$product.'"]');

  }

  $html.='<style>.courseitem p.product.woocommerce.add_to_cart_inline {

    border: none !important;

  }</style>';

  return $html;

}

 

Leave a Reply

Your email address will not be published. Required fields are marked *