Support

Account

Home Forums Front-end Issues My extra field description on product category page doesn't update when changing

Unread

My extra field description on product category page doesn't update when changing

  • Hey,
    My extra field description on product category page doesn’t update when changing product category filters. Filters are set to singular use. The default category description changes correctly.

    This is the function I used works fine exept when changing category from the filter:

    add_action( ‘woocommerce_after_main_content’, ‘my_extra_description’ );
    function my_extra_description() {

    global $wp_query;
    apply_filters( ‘acf/update_value’, $value, $post_id, $field, $original );
    # get the query object
    $category = $wp_query->get_queried_object();
    #get the cat ID
    $category_ID = $category->term_id;

    #get the field
    $contenu_categorie = get_field( ‘contenu_categorie’, ‘category_’.$category_ID );
    #if we have data, show it
    if( $contenu_categorie ){
    echo $contenu_categorie;
    }

    }

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.