파일 이메일 주문 items.php는 다음 코드 줄을 가지고Woocommerce 재정의 플러그인 동작
add_action('woocommerce_order_formatted_line_subtotal', array($this, 'wc_cp_order_item_subtotal'), 10, 3);
wc_cp_order_item_subtotal 함수를 재정 의하여 항목 합계가 표시되는 방식을 변경하고 싶습니다. 나는 자식 테마 functions.php에 다음을 추가하려고 시도했지만 아무 것도하지 않는다.
remove_action('woocommerce_order_formatted_line_subtotal', 'wc_cp_order_item_subtotal', 10);
add_action('woocommerce_order_formatted_line_subtotal', 'child_wc_cp_order_item_subtotal', 10, 3);
function child_wc_cp_add_order_item_meta($order_item_id, $cart_item_values, $cart_item_key = '') {
return 'xxxxxxx';
}
이 작업을 수행하는 데 도움이되는 팁은 크게 감사하겠습니다.
감사합니다. 공식 Woocommerce Composite Product 플러그인을 사용하고 있지만 버전 2.4.0에서 코드를 리팩토링하고 BTO에 대한 참조를 제거한 것처럼 보입니다. $ woocommerce_bto-> order-> woocommerce_bto와 동일한 기능을 수행하려면 어떻게해야합니까? –
'bto'가 'cp'가되었고 'woo'가 'wc'가 된 것처럼 보입니다. 그래서 전체 플러그인의 전역 변수는'$ woocommerce_composite_products'이고'WC_CP_Order()'클래스는 주 클래스의'order' 변수로 초기화되어 있으므로'$ woocommerce_composite_product-> order'가됩니다. 나는 그 여분의'woocommerce_bto'를 어디에서 가져 왔는지 모르겠다. 아마도 복사/붙여 넣기가 실패 할 것이다. – helgatheviking
그것이 작동합니다 - 대단히 감사합니다! –