jeudi 3 octobre 2019

Rand order in stock SQL Woocommerce

I have these 2 codes, currently it runs randomly but it does not filter the products in stock. How would it be to be random and respect woocommerce "instock" products?

Code1:$sortQuery = 'ORDER BY RAND()';

Code 2: $sortQuery = ' AND id NOT IN (SELECT post_id FROM'.FSwpTable('feeds')."WHERE schedule_id='" . (int)$scheduleId . "') ORDER BY RAND()";

I have understood that the stock is stored here

meta_value = _stock_status WHERE meta_key = 'instock';

Thanks




Aucun commentaire:

Enregistrer un commentaire