Created
December 3, 2018 05:35
-
-
Save rayflores/826d00cdd3e619de8d5c5945bfa81ff1 to your computer and use it in GitHub Desktop.
Divi shop module - remove products without product images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# from Divi shop module Shop.php | |
# $toggle_filter( 'woocommerce_shortcode_products_query', array( $this, 'shortcode_products_query_cb' ), 10 ); | |
# from WC class-wc-shortcode-products.php | |
# $query_args = apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type ); | |
# $query_args['meta_query'] = WC()->query->get_meta_query(); | |
add_filter( 'woocommerce_shortcode_products_query', 'remove_if_no_thumbnail', 20, 3); | |
function remove_if_no_thumbnail( $query_args, $attributes, $type ){ | |
$query_args['meta_query'] = array( | |
array ( | |
'key' => '_thumbnail_id' | |
) | |
); | |
return $query_args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment