반응형
woocommerce에 모든 주문을 볼 수 있는 쇼트 코드/페이지가 있습니까?
워드프레스 사이트에서 플러그인 woocommerce를 사용하고 있는데, 회원님이 주문 내역을 볼 수 있는 섹션이 필요합니다.woocommerce에 멤버의 주문 내역을 보여주는 쇼트코드나 페이지가 있나요?
내 계정 단축 코드:
[woocommerce_my_account order_count="-1"]
고객이 과거 주문을 보고 정보를 업데이트할 수 있는 '내 계정' 섹션을 표시합니다.표시할 수 또는 순서를 지정할 수 있습니다. 기본적으로는 15로 설정됩니다(모든 순서를 표시하려면 -1 사용).
레퍼런스:Woocommerce 쇼트코드
갱신하다
주문만 필요한 경우 쇼트코드가 있는지 모르겠지만 woocommerce_my_account를 예로 들어 작성했습니다.
function shortcode_my_orders( $atts ) {
extract( shortcode_atts( array(
'order_count' => -1
), $atts ) );
ob_start();
wc_get_template( 'myaccount/my-orders.php', array(
'current_user' => get_user_by( 'id', get_current_user_id() ),
'order_count' => $order_count
) );
return ob_get_clean();
}
add_shortcode('my_orders', 'shortcode_my_orders');
이 기능을 추가합니다.php 파일을 사용한 후 다음과 같이 사용합니다.[my_orders order_counts=10]
(order_counts
생략 시 모든 주문이 표시됩니다).
추출물에 대해 읽고 있었는데 워드프레스에서 더 이상 추천하지 않는 것 같아요.솔로티온을 찾았어요 도움이 됐으면 좋겠네요
function shortcode_my_orders( $atts ) {
$args= shortcode_atts(
array(
'order_count' => -1
),
$atts
);
$order_count = esc_attr( $args['order_count'] );
ob_start();
wc_get_template( 'myaccount/my-orders.php', array(
'current_user' => get_user_by( 'id', get_current_user_id() ),
'order_count' => $order_count
) );
return ob_get_clean();
}
언급URL : https://stackoverflow.com/questions/29980505/in-woocommerce-is-there-a-shortcode-page-to-view-all-orders
반응형
'sourcecode' 카테고리의 다른 글
angularJS는 Base64 이미지를 표시합니다. (0) | 2023.02.11 |
---|---|
AJAX(특히 jQuery)를 통해 로드된 Javascript를 디버깅하려면 어떻게 해야 합니까? (0) | 2023.02.11 |
WordPress REST API에서 원시 HTML 출력 가져오기 (0) | 2023.02.07 |
JObject를 사전으로 변환합니다. 가능합니까? (0) | 2023.02.07 |
Word press - get_results() - 실패 또는 비어 있는지 확인하는 방법 (0) | 2023.02.07 |