Array
(
[0] => Array( [0] => http:// categories-categories-5-1-150х150.png, [1] => http:// categories-categories-2-1-150х150.png )
[1] => Array( [0] => http:// categories-categories-5-1.png-250x250.png, [1] => http:// categories-categories-2-1-250х250.png
}
$array = [];
foreach ( $variations as $variation ) {
$images_variation_origin = get_the_post_thumbnail_url( $variation, 'shop_single' );
$images_variation_thumbnail = get_the_post_thumbnail_url( $variation, 'shop_thumbnail' );
array_push($array, array($images_variation_origin));
array_push($$array, array($images_variation_thumbnail));
}
Array
(
[0] => Array( [0] => http:// categories-categories-5-1-150х150.png, [1] => http:// categories-categories-2-1-150х150.png )
[1] => Array( [0] => http:// categories-categories-5-1.png-250x250.png, [1] => http:// categories-categor
$array = [];
foreach ( $variations as $variation ) {
$images_variation_origin = get_the_post_thumbnail_url( $variation, 'shop_single' );
$images_variation_thumbnail = get_the_post_thumbnail_url( $variation, 'shop_thumbnail' );
array_push($array, array($images_variation_origin));
array_push($$array, array($images_variation_thumbnail));
}
Array
(
[0] => Array( [0] => http:// categories-categories-5-1-150х150.png, [1] => http:// categories-categories-2-1-150х150.png )
[1] => Array( [0] => http:// categories-categories-5-1.png-250x250.png, [1] => http:// categories-categories-2-1-250х250.png
}
$array = [];
foreach ( $variations as $variation ) {
array_push($array, $variation['image']['url']);
}
$array = array_unique($array);
var_dump($array); //print final array
Array
(
[0] => Array( http:// categories-categories-5-1-150х150.png, http:// categories-categories-2-1-150х150.png )
[1] => Array( http:// categories-categories-2-1.png-250x250.png, http:// categories-categories-2-1-250х250.png
}
Sets product images for the chosen variation
img[src="' + variation.image.thumb_src + '"]
и он показывает путь одной миниатюры - белый цвет, а если кликнуть по второй миниатюре, то покажет черный цветvariable_product = wc_get_product( absint( $_POST['product_id'] ) );
$data_store = WC_Data_Store::load( 'product' );
$variation_id = $data_store->find_matching_product_variation( $variable_product, wp_unslash( $_POST ) );
$variation = $variation_id ? $variable_product->get_available_variation( $variation_id ) : false;
function breadcrumbs($separator = ' » ', $home = 'Главная') {
$path = array_filter(explode('/', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)));
$base_url = ($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
$breadcrumbs = array("<a href=\"$base_url\">$home</a>");
$last = end( array_keys($path) );
foreach( $path as $x => $crumb ){
$title = ucwords(str_replace(array('.php', '_'), Array('', ' '), $crumb));
if( $x != $last ){
$breadcrumbs[] = '<a href="'.$base_url.$crumb.'">'.$title.'</a>';
}
else {
$breadcrumbs[] = $title;
}
}
return implode( $separator, $breadcrumbs );
}
А может можно как-то на сервере (когда цикл выводит размеры) получить variation.is_in_stock ?