WordPress Redux Framework - Display WooCommerce Products in Select Field Options

I’m working with the Redux Framework in WordPress and need to populate a select dropdown with WooCommerce products. I want to create a dropdown menu that shows all available products from my store, but I’m having trouble figuring out the correct way to fetch and display them.

I’ve tried using the basic select field configuration, but I’m not sure how to properly call the product data. Here’s what I have so far:

$options = array(
    'field_id' => 'store_item_selector',
    'field_type' => 'select',
    'data_source' => 'post_type',
    'parameters' => array(
        'post_type' => 'product',
    )
);

Can someone help me understand the proper method to retrieve and show product listings in a Redux select dropdown?

WooCommerce products are tricky with Redux since they’ve got extra metadata that regular posts don’t have. I’ve hit this same wall before - WooCommerce’s built-in functions work way better than generic post queries. Here’s what I use:

$product_options = array();
$products = wc_get_products(array('limit' => -1, 'status' => 'publish'));
foreach($products as $product) {
    $product_options[$product->get_id()] = $product->get_name();
}

$fields[] = array(
    'id' => 'store_item_selector',
    'type' => 'select',
    'title' => 'Select Product',
    'options' => $product_options
);

This grabs only actual WooCommerce products - no drafts or private items that’ll mess things up. Plus wc_get_products automatically handles WooCommerce’s visibility settings.

Your data_source approach is correct, but you need to structure it right in the Redux field config. You’re probably not defining it as part of the complete field array. Here’s the proper syntax:

$fields[] = array(
    'id' => 'store_item_selector',
    'type' => 'select',
    'title' => 'Select Product',
    'data' => 'posts',
    'args' => array(
        'post_type' => 'product',
        'posts_per_page' => -1,
    )
);

I’ve used this exact method in several client projects and it works reliably. The key difference is using ‘data’ => ‘posts’ instead of ‘data_source’ => ‘post_type’. Redux automatically handles the formatting and displays product titles as options with post IDs as values.

Try get_posts() with the product post type instead. Use 'options' => get_posts(['post_type' => 'product', 'numberposts' => -1]) - it’ll work better than the data_source method. Just format your array as key=>value pairs since Redux needs that for dropdowns.