2016-06-16 2 views
0

"장바구니에 담기"버튼을 클릭 한 후 표시되는 Woocommerce의 "장바구니보기"버튼에서 URL을 변경하는 방법은 무엇입니까? 나는 http://myshop.com/checkout을 기본값으로두고 체크 아웃과 결합 된 사용자 정의 페이지로 URL을 변경하려고합니다. http://myshop.com/custom-pageWoocommerce의 "장바구니보기"버튼에서 URL을 변경하는 방법은 무엇입니까?

js 동작을 변경해야한다는 것을 알고 있지만 어떻게해야합니까?

답변

3

당신은이 필터는 언어에 대한 작동 woocommerce_get_checkout_url

function so_37863005_checkout_url($url){ 

    // Force SSL if needed 
    $scheme = (is_ssl() || 'yes' === get_option('woocommerce_force_ssl_checkout')) ? 'https' : 'http'; 
    $url = site_url('/custom-page/', $scheme); 

    return $url; 
} 
add_filter('woocommerce_get_checkout_url', 'so_37863005_checkout_url', 10, 2); 
1

를 통해 체크 아웃 URL을 필터링 할 수 있습니다. Polylang과 Loco는 버튼에 대한 UI 표시 문자열을 처리하며이 함수는 url을 처리합니다.

$currentlanguage = get_bloginfo('language'); 

add_filter('woocommerce_get_checkout_url', 'my_checkout'); 

function my_checkout($url) { 
    global $woocommerce; 
    if($currentlanguage = "zh-CN"){ 
     return $checkout_url = 'http://example.com/zh/chinese_checkout/'; 
     } 
    if ($currentlanguage = "en-US"){ 
     return $checkout_url = 'http://example.com/en/english_checkout/'; 
     } 
    }; 
+0

감사합니다,하지만 난 그 가게에서 하나의 언어 만이 있었다 :) –

+0

그런 다음 @helgatheviking이 해결책을 가졌습니다. 또는 'add_filter ('woocommerce_get_checkout_url ','my_checkout ');을 사용할 수 있습니다. 함수 my_checkout ($ url) { global $ woocommerce; return $ checkout_url = 'http://example.com/whatever/'; }; – Terri

+0

마크 업이 추가되었습니다. url 다음에. 그건 틀렸어요. – Terri

-1

다음 원시 편집 wp-content\plugins\woocommerce\includes\wc-template-functions.php

로 이동 1429

function woocommerce_widget_shopping_cart_button_view_cart() { 
     echo '<a href="' . esc_url(wc_get_cart_url()) . '" class="button wc-forward">' . esc_html__('View cart', 'woocommerce') . '</a>'; 
} 
function woocommerce_widget_shopping_cart_button_view_cart() { 
     echo '<a href="' . esc_url(wc_get_cart_url()) . '" class="button wc-forward">' . esc_html__('your text', 'woocommerce') . '</a>'; 
} 

버전 woocommerce 3.0.3 강력한 텍스트

+0

다른 플러그인의 파일을 절대 편집하지 마십시오. 업데이트하면 변경 사항이 손실됩니다. – Camilo

관련 문제