I have something wrong with:
PHP Warning: array_push() expects parameter 1 to be array, string given in
the code in function.php is:
global $wpdb;
$i=0;
$key_count=array();
$order_id = $order->get_id();
$order = wc_get_order($order_id);
foreach( $order->get_items() as $item_id => $item ){
//Get the product ID
$product_id = $item->get_product_id();
$key_count[$i] = $wpdb->get_var("SELECT count(license_key) FROM bff_lmfwc_licenses where product_id='$product_id'and order_id is NULL");
$i=$i+1;
array_push($key_count[0],$key_count[$i]);
}
Can you see my mistake?