Hi @vol4ikman,
Please update the plugin to the latest v1.6.0 – I’ve added a new function to get all discounted product ids:
alg_wc_gsd_get_product_ids( $product_query_args = array( 'limit' => -1 ), $incl_on_sale = true, $use_transient = false )
The function has three optional parameters:
$product_query_args
– sets which products to check. By default, it’s set to all products, i.e., array( 'limit' => -1 )
. This parameter is passed directly to the WooCommerce wc_get_products()
function, so you can use all the same parameters as listed in the documentation.
$incl_on_sale
– if set to true
, will return all on-sale products in your shop, including products that you have set on-sale manually, without using our plugin.
$use_transient
– the function goes through all products in your shop, so it can be rather slow, especially if you have a lot of products in your shop. To speed things up, you can store results in a transient by setting the parameter to true
. The transient expires after 24 hours.
Please give it a try and let me know what you think.