Hi there,
I have a question / problems regarding GP with WC regarding related products.
I know that GP offers several settings regarding WooCommerce display options in the customizer.
There is also a setting to change the “Related/Upsell Columns”.
I need to change the query of the related products output.
In short: Every product has a specific meta-field, if the field-value equals “something”, than the product should not show up in the related products. So I need to add a meta-query to the related post query.
The thing is, all the code I already tried to change the query of the related products isnt working.
Even just changing just the “post_per_page” or “columns” isnt working, something like this. (this code is sitting in a small custom plugin)
add_filter( 'woocommerce_output_related_products_args', 'prfx_change_related_products_count' );
function prfx_change_related_products_count( $args ) {
$args['posts_per_page'] = 4;
$args['columns'] = 1;
return $args;
}
I also tried different WC hooks but the related posts output just doesnt change at all.
It seems that only the customizer settings get applied but not my code.
Is it possible that the customizer setting is overwriting my code or that GP uses it own hooks?!
Thanks,
have a nice day!