Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

WP Query ALL

\’orderby\’ => array(
\’acf-mailchimp-include\’ => ‘DESC’
)

// WP_Query arguments
$args = array(
	'post_type'              => array( 'product' ),
	'post_status'            => array( 'publish' ),
	'tax_query'              => array(
		'relation' => 'AND',
		array(
			'taxonomy'         => 'product_cat',
			'terms'            => array( 'utgar', 'specialritade-diskbankar', 'offerter', 'temp', 'returfrakter', 'outlet', 'tillfalligt-pa-lager' ),
			'field'            => 'slug',
			'operator'         => 'NOT IN',
		),
		array(
			'taxonomy'         => 'product_visibility',
			'terms'            => array( 'exclude-from-catalog', ' exclude-from-search'' ),
			'field'            => 'name',
			'operator'         => 'NOT IN',
		),
	),
	'meta_query'             => array(
		'relation' => 'AND',
		array(
			'key'     => 'acf-p_status_status',
			'value'   => 'discontinued',
			'compare' => '!=',
		),
		array(
			'key'     => 'acf-mailchimp-exclude',
			'value'   => '1',
			'compare' => '!=',
		),
		array(
			'key'     => 'acf-mailchimp-include',
			'compare' => 'EXISTS',
			'type'    => 'DATETIME',
		),
	),
);

// The Query
$query = new WP_Query( $args );