Support » Plugin: WooCommerce » WC3: Add Code for first product image?

  • Hello,

    after updating to WooCommerce 3 with the new gallery, I can’t put some code into the new template to work.

    We have got more flashes like the “Sale” flash, only in the other corners. In WooCommerce 2.x I have put a div around the first image followed by the custom flashes, so that these flashes can be positioned via the parent div.

    This was the old code in /single-product/product-image.php (line 1 and 3 were original, the others are added by me):

    <div class="images">
    <div class="ab-singleproduct-imagebox">
    	<?php
    	
    	global $wp_query;
    	$postid = $wp_query->post->ID;
    	$produktart = get_post_meta($postid, 'produktart', true);
    	$upload_dir = wp_upload_dir();
    	if ($produktart == 'neu') { 
    		echo '<span class="ab-produktart-neu">Neu</span>';
    	}
    	$produktaktion = get_post_meta($postid, 'produktaktion', true);
    	if (!empty($produktaktion)) {
    		echo '<span class="ab-produktaktion">' . $produktaktion . '</span>'; 
    	}
    	$produktbonus = get_post_meta($postid, 'produktbonus', true);
    	if (!empty($produktbonus)) {
    		echo '<span class="ab-produktbonus">' . $produktbonus . '</span>'; 
    	}
    	$produktinfo = get_post_meta($postid, 'produktinfo', true);
    		if (!empty($produktinfo)) {
    		echo '<span class="ab-produktinfo">' . $produktinfo . '</span>'; 
    	}  

    The new div was closed later in the code. I think that this doesn’t matter now. I only want to show you the situation and hope that there is a way to add these flash codes directly before the first image (that is already wrapped into a div) in the new code.

    Thank you.

    • This topic was modified 2 years, 5 months ago by Apfelbiss.
    • This topic was modified 2 years, 5 months ago by Apfelbiss.
  • The topic ‘WC3: Add Code for first product image?’ is closed to new replies.