• Resolved hannahjohnson438

    (@hannahjohnson438)


    I’ve noticed that the price filter I’ve created on my shop page will only filter by the native price (GBP) not by the price of the country the user is in. This means when I’m testing in Europe if I use the filter I get products that are €5-10 higher than my filter.

    Relevant part of the query looks like this:

    ‘meta_query’ => array(
    array(
    ‘key’ => ‘_price’,
    ‘value’ => array($min, $max),
    ‘compare’ => ‘between’,
    ‘type’ => ‘numeric’
    )
    )

    $min & $max are values passed through AJAX from the filter slider.

    Is there a way to query by this plugin’s price instead?

Viewing 1 replies (of 1 total)
  • Plugin Author Oscar Gare

    (@oscargare)

    Hi,

    $metakey = '_price';
    if ( function_exists( 'wcpbc_the_zone' ) && wcpbc_the_zone() ) {
        $metakey = wcpbc_the_zone()->get_postmetakey( '_price' );
    }
    
    'meta_query' => array(
        array(
            'key' => $metakey,
            'value' => array($min, $max),
            'compare' => 'between',
            'type' => 'numeric'
        )
    );
Viewing 1 replies (of 1 total)
  • The topic ‘Issue with filtering products by price in wp_query’ is closed to new replies.