Please use wc_get_products in dropdown_fields()
-
Hi there, thanks for building this Plugin and maintaining it. Please note that direct database access is not recommended and WC functions are available to mitigate this.
File: woocommerce-filter-orders-by-product/inc/filter-by-product.php
Here’s also a way to allow the Plugin user to format the Product option label, i.e. appending the SKU
$args = array(
‘status’ => apply_filters( ‘wfobp_product_status’, ‘publish )
);
$products = wc_get_products( $args );
foreach( $products as $product ) {
$fields[$product->get_id()] = apply_filters( ‘wfobp_product_option_label’, $product->get_title, $product );
}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Please use wc_get_products in dropdown_fields()’ is closed to new replies.