Support

Account

Home Forums General Issues ACF Group does not work on shop page (Woocommerce) Reply To: ACF Group does not work on shop page (Woocommerce)

  • If you want to get fields from the page set as the “Shop” page in WC, then you need to supply the correct ID for ACF to know where to get the fields from.

    The issue here is that you the page is an archive page and the query is altered when loading the “Shop” page to point to the archive instead of the page.

    Anyway, I discovered this while working on a bug on a site. WC will show the “Content” of the “Shop” page as description for the archive page. Here is the WC function that does this.

    If you’re interested the function that does this is woocommerce_product_archive_description() in the file ...plugins/woocommerce/includes/wc-template-functions.php

    Anyway, to get the ID of the “Shop” page do

    
    $shop_page_id = wc_get_page_id('shop');
    

    Then use that ID for ACF calls

    
    <section class="main-banner container-full">
    
      <img class="logo" src="<?php bloginfo('template_url'); ?>/assets/images/logo.svg" alt="logo">
    
      <?php if( have_rows('main_banner', $shop_page_id) ):
        while( have_rows('main_banner', $shop_page_id) ): the_row(); ?>
    
        <img src="<?php the_sub_field('image'); ?>">
    
        <?php endwhile;
      endif; ?>
    
    </section>