Merge pull request #27908 from woocommerce/fix/template-attachment-ids
restore $attachment_ids for product thumbnails template
This commit is contained in:
commit
c530fc0d55
|
@ -1477,13 +1477,16 @@ if ( ! function_exists( 'woocommerce_show_product_images' ) ) {
|
||||||
function woocommerce_show_product_images() {
|
function woocommerce_show_product_images() {
|
||||||
global $product;
|
global $product;
|
||||||
$post_thumbnail_id = $product->get_image_id();
|
$post_thumbnail_id = $product->get_image_id();
|
||||||
|
$gallery_image_ids = '';
|
||||||
|
|
||||||
if ( ! $post_thumbnail_id ) {
|
if ( ! $post_thumbnail_id ) {
|
||||||
$gallery_image_ids = $product->get_gallery_image_ids();
|
$gallery_image_ids = $product->get_gallery_image_ids();
|
||||||
if ( ! empty( $gallery_image_ids ) ) {
|
if ( ! empty( $gallery_image_ids ) ) {
|
||||||
$post_thumbnail_id = array_shift( $gallery_image_ids );
|
$post_thumbnail_id = array_shift( $gallery_image_ids );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wc_get_template( 'single-product/product-thumbnails.php', array( 'post_thumbnail_id' => $post_thumbnail_id ) );
|
$args = compact( 'post_thumbnail_id', 'gallery_image_ids' );
|
||||||
|
wc_get_template( 'single-product/product-image.php', $args );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_show_product_thumbnails' ) ) {
|
if ( ! function_exists( 'woocommerce_show_product_thumbnails' ) ) {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*
|
*
|
||||||
* @see https://docs.woocommerce.com/document/template-structure/
|
* @see https://docs.woocommerce.com/document/template-structure/
|
||||||
* @package WooCommerce\Templates
|
* @package WooCommerce\Templates
|
||||||
* @version 4.6.0
|
* @version 4.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*
|
*
|
||||||
* @see https://docs.woocommerce.com/document/template-structure/
|
* @see https://docs.woocommerce.com/document/template-structure/
|
||||||
* @package WooCommerce\Templates
|
* @package WooCommerce\Templates
|
||||||
* @version 4.6.0
|
* @version 4.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
Loading…
Reference in New Issue