I'm trying to get the images (or the image URLS) of the elements that are added in the fancy product designer. I've found the following code, but this one is written for the current color instead of current image. The title of the elements are shown, but I cannot find a solution to find the images (or the image URLS).
Thanks in advance!
add_filter( 'woocommerce_get_item_data', 'wc_checkout_description_tp', 10, 2 );
function wc_checkout_description_tp( $other_data, $cart_item ){
//re-convert the fpd dtails from the json sting to an array
$fpd_detail_arr = json_decode( html_entity_decode( stripslashes( $cart_item['fpd_data']['fpd_product'] ) ), true );
//remove the first element as we are not dealing with shadows
$fpd_elems_arr = array_slice($fpd_detail_arr[0]['elements'], 1);
//loop each element and set the details to a var
foreach($fpd_elems_arr as $elem_key => $element_arr){
foreach($element_arr as $key => $value){
//the currentColor value is set inside yet another array
if(is_array($value)){
foreach($value as $val_key => $val_val){
if( $val_key == 'currentColor' && !empty($val_val) ){
$fpd_detail_value = $val_val;
}
}
}
//set the title value
else{
if( $key == 'title' && !empty($value) ){
$fpd_detail_name = trim($value);
}
}
}
//add the name and value pair to the detail array
$other_data[] = array(
'name' => $fpd_detail_name,
'value' => $fpd_detail_value
);
}
//return the final detail array
return $other_data;
}