Merge pull request #27908 from woocommerce/fix/template-attachment-ids

restore $attachment_ids for product thumbnails template
This commit is contained in:
Claudio Sanches 2020-10-14 15:38:19 -03:00 committed by GitHub
commit c530fc0d55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -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' ) ) {

View File

@ -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;

View File

@ -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;