Tutor LSM 템플릿에 바로구매를 적용하고 싶어요.

* 엠샵 바로구매 플러그인 4.1.1 버전 이상이어야 합니다. 플러그인 버전이 낮은 경우 업데이트해 주시기 바랍니다.

[1] 아래의 커스텀 코드를 차일드 테마의 functions.php 파일에 추가해 주시기 바랍니다.
(/wp-content/themes/테마이름-child/functions.php)

add_filter( 'msbn_output_add_to_cart_product_id', '__return_true' );


function cbduck_get_tutor_product( $product ) {
  if ( ! is_a( $product, 'WC_Product' ) && function_exists( 'tutor_utils' ) ) {
    $product_id = tutor_utils()->get_course_product_id();
    $product    = wc_get_product( $product_id );
  }

  return $product;
}

add_filter( 'msbn_get_product', 'cbduck_get_tutor_product' );

add_action( 'woocommerce_after_add_to_cart_button', array( 'MSBN_Cart', 'buynow_button_variable' ), 30 );
add_action( 'woocommerce_after_add_to_cart_button', array( 'MSBN_Cart', 'buynow_button_simple' ), 30 );

[2] [우커머스 > 설정 > 바로구매 > 바로구매 설정 > 버튼 위치 설정 영역]
또는 [Shop 설정 > 기본 설정 > 바로구매 > 바로구매 설정 > 버튼 위치 설정 영역] 에
옵션상품과 기타상품(단순상품 포함) 설정 모두 tutor_before_add_to_cart_button로 변경해 주시기 바랍니다.

Category: 바로구매
Was this article helpful to you? Yes No