Support

Account

Home Forums ACF PRO Can't get repeater field value on WooCommerce search page

Solved

Can't get repeater field value on WooCommerce search page

  • Hello everyone,

    I’m currently working on a WooCommerce webshop and I’ve come across a strange issue regarding ACF + WooCommerce. I have an options page where I use a repeater field. This is working like a charm on all pages, except for the WooCommerce search page.

    To output the repeater values, I use the regular method described in the documentation. So this is working like it should everywhere on the site, but not on the WooCommerce search page (domain.com/?s=test&post_type=product). When I try to debug and var_dump the repeater contents using var_dump(get_field('repeater_field_name', 'options'));, I just see a string with the number of rows in the repeater field. Like so: string(1) "4". All other pages return me an array with the contents of the repeater field (like they should).

    I’ve tried disabling all plugins except WooCommerce and ACF Pro and switching themes. With no result. I’m really struggling with this as I’m clueless to what’s the problem here.

    If anyone can help me with this I would be really happy 🙂

    Thanks in advance!

    EDIT: Just to give you some more information.. when I use the default WordPress search (domain.com/?s=test) everything is working fine. The problem only occurs when searching for products.

  • UPDATE
    I got it to work (thanks to ACF support), so it seems only right to let you guys know if you ever run into this problem.

    The solution for getting the repeater values to appear on the WooCommerce search page was the use of acf-json. This way, the field groups are loaded locally and not from the database. So the field definition lookup query is not affected by any other WP filters.

    Worked like a charm!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.