Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * JKIt Hide Out of Stock Items
- *
- * Hide Out of Stock Product in Jeg Elementor Kit Query's
- * Executed if is Jeg Elementor Kit Query and Post Type is Product (WooCommerce)
- *
- * @param array $args \WP_Query Arguments.
- * @param array $attr Attribute.
- */
- function jkit_hide_out_of_stock_items( $args, $attr ) {
- if ( isset( $attr['post_type'] ) && 'product' === $attr['post_type'] ) {
- $args['meta_key'] = '_stock_status';
- $args['meta_value'] = 'outofstock';
- $args['meta_compare'] = '!=';
- }
- return $args;
- }
- add_filter( 'jeg_default_query_args', 'jkit_hide_out_of_stock_items', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement