반응형
woocommerce 커스텀 오더 상태를 추가하려면 어떻게 해야 하나요?
아래 기능을 사용하여 새로운 커스텀 오더 상태를 woocommerce에 추가하였습니다.
// Register New Order Statuses
function wpex_wc_register_post_statuses() {
register_post_status( 'wc-custom-order-status', array(
'label' => _x( 'Shipping In Progress', 'WooCommerce Order status', 'text_domain' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Approved (%s)', 'Approved (%s)', 'text_domain' )
) );
}
add_filter( 'init', 'wpex_wc_register_post_statuses' );
// Add New Order Statuses to WooCommerce
function wpex_wc_add_order_statuses( $order_statuses ) {
$order_statuses['wc-custom-order-status'] = _x( 'Shipping In Progress', 'WooCommerce Order status', 'text_domain' );
return $order_statuses;
}
add_filter( 'wc_order_statuses', 'wpex_wc_add_order_statuses' );
주문을 편집하고 새로 추가된 커스텀 주문 상태로 변경 후 Save Order 버튼을 클릭합니다.주문 상태를 로드한 후 자동으로 Pending Order로 변경되며 새로 추가된 커스텀 오더에 추가되지 않음...
이 문제를 어떻게 극복할 것인가...?
등록하려는 주문 상태wc-custom-order-status
너무 길다 -22
성격.그 결과, 투고 상태의 처음 20 문자만이 보존되어 무효가 되어, 문제가 발생합니다.
주문 상태는 투고 상태로 등록되며 투고 상태에는 다음과 같은 제한이 있습니다.20
성격.
최신 정보를 갱신할 것을 권장합니다.wc-custom-order-status
상태 이름wc-shipping-progress
정확히는20
글자 길이
참고로 코드 업데이트 버전도 게시합니다(상태 이름만 변경했습니다).
// Register New Order Statuses
function wpex_wc_register_post_statuses() {
register_post_status( 'wc-shipping-progress', array(
'label' => _x( 'Shipping In Progress', 'WooCommerce Order status', 'text_domain' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Approved (%s)', 'Approved (%s)', 'text_domain' )
) );
}
add_filter( 'init', 'wpex_wc_register_post_statuses' );
// Add New Order Statuses to WooCommerce
function wpex_wc_add_order_statuses( $order_statuses ) {
$order_statuses['wc-shipping-progress'] = _x( 'Shipping In Progress', 'WooCommerce Order status', 'text_domain' );
return $order_statuses;
}
add_filter( 'wc_order_statuses', 'wpex_wc_add_order_statuses' );
언급URL : https://stackoverflow.com/questions/29789680/how-to-add-woocommerce-custom-order-status
반응형
'sourcecode' 카테고리의 다른 글
do_action과 add_action은 어떻게 작동합니까? (0) | 2023.02.28 |
---|---|
Woocommerce REST API에서 범주별로 제품 가져오기 (0) | 2023.02.28 |
스프링 부트:장치 테스트에서 클래스 경로에서 리소스를 읽는 방법 (0) | 2023.02.28 |
형식 설명: 'react' 모듈을 찾을 수 없습니다. (0) | 2023.02.28 |
Angularjs는 거부 체인을 약속합니다. (0) | 2023.02.28 |