나는 제품 변형을 얻기 위해 다음 함수 호출을 사용, woocommerce의 변형 ID에서 변형 이름을 검색하려면 어떻게해야합니까?
$available_variations = $product->get_available_variations();
그리고이 모든 변화를 반환 $ available_variations에서
.나는 variation_id가 주어졌으며 속성의 이름을 알지 못합니다.이 경우 원산지 국가입니다. 그래서 홍콩과 싱가포르의 속성 값을 검색하려면 어떻게해야합니까? 이 경우에는? 다음은
는[18-Mar-2014 17:04:20 UTC] Array
(
[variation_id] => 2968
[attributes] => Array
(
[attribute_pa_country-of-origin] => hong-kong
)
[image_src] =>
[image_link] =>
[image_title] =>
[image_alt] =>
[price_html] => <span class="price"><span class="amount">SGD$15</span></span>
[availability_html] =>
[sku] =>
[weight] => kg
[dimensions] =>
[min_qty] => 1
[max_qty] => 0
[backorders_allowed] =>
[is_in_stock] => 1
[is_downloadable] =>
[is_virtual] =>
[is_sold_individually] => no
)
[18-Mar-2014 17:04:20 UTC] Array
(
[variation_id] => 2969
[attributes] => Array
(
[attribute_pa_country-of-origin] => singapore
)
[image_src] =>
[image_link] =>
[image_title] =>
[image_alt] =>
[price_html] => <span class="price"><span class="amount">SGD$12</span></span>
[availability_html] =>
[sku] =>
[weight] => kg
[dimensions] =>
[min_qty] => 1
[max_qty] => 0
[backorders_allowed] =>
[is_in_stock] => 1
[is_downloadable] =>
[is_virtual] =>
[is_sold_individually] => no
)
이것은 포스터가 요청한 것이 아니며, 변형 ID에서 변형의 이름을 가져 오려고합니다. – Roy