Support

Account

Home Forums Front-end Issues ACF and WooCommerce Shop Page

Unread

ACF and WooCommerce Shop Page

  • I use ACF prugin for WooCommerce child theme
    I try to create fields for yourtheme/woocommerce/content-product.php page.
    I need to show image with text for product listing and categories

    So I created Shop Field Group – Shop page image and text

    For Shop image:
    field type = image
    field name = shop_page_image
    return format = image url
    library = all

    Location rules
    Show this field group if
    page is equal to Shop ( I have page for WooCommerce shop page in backend )
    or
    page is equal to Home ( add it for testing )

    I can add image to Shop page and Home using WordPress edit page
    And if I try to show image using this

    <?php $shop_image = get_field('shop_page_image');
      var_dump($shop_image);
    ?>

    or

    <?php 
    $image = get_field('shop_page_image');
    if( !empty($image) ): ?>
       <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
    <?php endif; ?>

    I get NULL for Shop page but I get image url for Home page. How to get field on Shop page too?
    I have child theme and WooCommerce folder in child theme has 2 files – archive-product.php and content-product.php

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.