Support

Account

Home Forums Add-ons Repeater Field ACF-Fields in WooCommerce -> product-overview/listing

Solved

ACF-Fields in WooCommerce -> product-overview/listing

  • Hello Community,
    I am currently trying to display ACF fields in the product overview in WooCommerce, these should also appear on the product detail page later. At the moment I am not able to do it at the usual pace. Has something changed or do you see a bug?
    I insert this in the content-product.php in woocommerce

        <?php 
        	global $product;
    		$produkturl = $product->get_attribute( 'produkturl' );
    		$buttontext = $product->get_attribute( 'buttontext' );
        ?>
    	<?php if( have_rows('partners') ): ?>
    		<div class="external-links">
    		<?php while( have_rows('partners') ): the_row(); ?>
    			<a href="<?php echo $produkturl; ?>" class="button product_type_external" aria-label="<?php echo $buttontext; ?>" rel="nofollow" target="_blank"><?php echo $buttontext; ?></a>
    		<?php endwhile; ?>
    		</div>
    	<?php endif; ?>
  • Hello, does anyone read the inquiries?

  • I solved it.

    		<?php if( have_rows('affiliatepartner') ): ?>
    			<div class="external-links">
    			<?php while( have_rows('affiliatepartner') ): the_row(); ?>
    				<?php
    					$produkturl = get_sub_field('produkturl');
    					$buttontext = get_sub_field('buttontext');
    				?>
    				<a href="<?php echo esc_url( $produkturl ); ?>" class="button product_type_external" aria-label="<?php echo $buttontext; ?>" rel="nofollow" target="_blank"><?php echo $buttontext; ?></a>
    			<?php endwhile; ?>
    			</div>
    		<?php endif; ?>
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.