Woocommerce 복합 제품 확장 (다른 제품 조합을 통해 제품을 만들 수 있음)과 함께 Woocommerce를 사용하고 있습니다.Woocommerce 복합 제품 구성 요소 가져 오기
복합 제품이 '재고 있음'인지 알아 내려고하지만, 일반적인 함수 인 is_in_stock()은 합성물에서 작동하지 않습니다.
더 적절한 기능이 있다면, 나는 그것이 무엇인지 알고 싶습니다.
$product = wc_get_product($productid);
var_dump($product);
반환 : 기본적으로
object(WC_Product_Composite)#11305 (23) {
["extended_data":"WC_Product_Composite":private]=>
array(7) {
["add_to_cart_form_location"]=>
string(7) "default"
["shop_price_calc"]=>
string(7) "default"
}
["composite_meta":"WC_Product_Composite":private]=>
array(4) {
[1477435352]=>
array(19) {
["component_id"]=>
string(10) "1477435352"
["query_type"]=>
string(11) "product_ids"
["assigned_ids"]=>
array(2) {
[0]=>
int(541)
[1]=>
int(588)
}
}
}
, 내가 원하는 것은 추출하고
Alternatrively, 기능 'wc_get_product는()'아래 componentproduct 아이디 (assigned_ids)를 포함하여 아래의 반환 각각의 재고가있는 경우 'assigned_ids'하위 배열 검사를 반복하되 화면에 인쇄하는 것 외에도이 객체의 속성은 '비공개'(완전히 익숙하지 않음)이기 때문에이 객체의 속성에 액세스 할 수 없습니다. 나는 이것을 Wordpress/플러그인 파일에서 수업을 사냥해서 알아낼 수 있다고 생각하지만, 어떻게 찾지는 모르겠다. 어떤 도움이라도 대단히 감사 할 것입니다.