Support » Plugin: Woo Zap Mirror » Filtering nodes by ACF field

  • Hi Ido!
    Thanks again for ur great plugin!
    I’m using it for a while and it does the job very well, now I’d like to improve it a little.
    I’d like to filter and exclude some products from the XML by using ACF field I manage.
    So in my functions.php I’m using wc_zap_mirror_xml_node action to map the correct fields and now as I said I want to exclude some products by the ACF field value. How do u suggest to do that? I think of getting the ACF field value first, then doing a If statement according, before the node placement, so if the expression is false, just to skip the placement..
    What do u think about it?
    Thanks a lot!

Viewing 1 replies (of 1 total)
  • Plugin Author Ido Friedlander


    Try this:

    add_filter( 'wc_zap_mirror_wp_query', function( $args ) {
    	$args['post__not_in'] = [ 1, 2, 3 ]; // list of product ids to exclude
    	return $args;
    } );
Viewing 1 replies (of 1 total)
  • The topic ‘Filtering nodes by ACF field’ is closed to new replies.