WooCommerce:ACF价值不是通过产品类别

I created custom fields for a WooCommerce category. Location shown below & they work correctly.

Woocommerce category ACF fields

However, when I go to my archive.php file and attempt a the_field('category_banner), it retrieves no data. Here is an example of how I've laid it out.

<?php
$categorybanner      = get_field('category_banner');
$categorydescription = get_field('category_description');
?>

<div class="container-fluid" id="ivy-banner" style="background: url('<?php echo $categorybanner ?>') center / cover"></div>
<h4 class="text-black"><?php echo $categorydescription; ?></h4>

Any reason why this code doesn't work? I can only assume it has got something to do with the location rather than the code itself. How can I circumvent this?

Please try the below Code. It may help you to get the values.

    <?php
  $term = get_queried_object();
  $categorybanner      = get_field('category_banner', $term);
  $categorydescription = get_field('category_description', $term);
?>

<div class="container-fluid" id="ivy-banner" style="background: url('<?php echo $categorybanner ?>') center / cover"></div>
<h4 class="text-black"><?php echo $categorydescription; ?></h4>