bigcommerce_get_primary_channel_status()

Summary

Get the status of the primary channel


Return

(mixed) The found value. null if not found.


Source

File: bigcommerce.php

function bigcommerce_get_primary_channel_status() {
	$cache_key = 'bigcommerce_primary_channel_status';
	$status    = wp_cache_get( $cache_key );
	if ( $status === false ) {
		global $wpdb;

		$sql = "SELECT tm.meta_value
				FROM {$wpdb->termmeta} tm
				INNER JOIN {$wpdb->termmeta} tm2 ON tm2.term_id=tm.term_id
				WHERE tm.meta_key=%s AND tm2.meta_key=%s AND tm2.meta_value=%s";

		$status = $wpdb->get_var( $wpdb->prepare(
			$sql,
			\BigCommerce\Taxonomies\Channel\BC_Status::STATUS,
			\BigCommerce\Taxonomies\Channel\Channel::STATUS,
			\BigCommerce\Taxonomies\Channel\Channel::STATUS_PRIMARY
		) );

		wp_cache_set( $cache_key, $status );
	}

    return $status;
}


User Contributed Notes

You must log in before being able to contribute a note or feedback.