0

I have custom post-type for products (with AFC filed price) I don´t have WooCommerce installed. But I would like to sort my products by price in a price filter. Any ideas how can I achieve that or someone can point me in right direction?

3

1 Answer 1

0

You should ACF meta_query to filter custom post type by custom field.

https://www.advancedcustomfields.com/resources/query-posts-custom-fields/

basic example:

$posts = get_posts(array(
    'numberposts'   => -1,
    'post_type'     => 'products',
    'meta_key'      => 'price',
    'meta_value'    => $value
));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.