私のWordpressウェブサイトでは、CheckoutページのWooCommerceを使用して、写真がCheckoutの商品リストの上に表示されています。表示されているように、どのように製品のリストに表示させるのですか?商品写真はCheckout(Wordpress/WooCommerce)の商品リストの上に表示されます
これは私が現時点で持っているものです。
add_action('woocommerce_checkout_before_order_review', 'displays_cart_products_feature_image');
function displays_cart_products_feature_image() {
foreach (WC()->cart->get_cart() as $cart_item) {
$item = $cart_item['data'];
if(!empty($item)){
$product = new WC_product($item->id);
// $image = wp_get_attachment_image_src(get_post_thumbnail_id($product->ID), 'single-post-thumbnail');
echo $product->get_image();
// to display only the first product image uncomment the line bellow
// break;
}
}
}
これはGet Cart products id on checkout WooCommerce page, to display product imagesに関連しています。
ありがとうございます!
...どのようにあなたがそれをコーディングしていますか? – Reigel
申し訳ありませんが、追加してください。それは今、元の投稿にあります。 –
あなたのフックは 'woocommerce_checkout_before_order_review'ですので、テーブルは注文レビューです – Reigel