WC_Helper::get_product_usage_notice_rules()
Get rules for displaying notice regarding marketplace product usage.
Method of the class: WC_Helper{}
No Hooks.
Return
Array
.
Usage
$result = WC_Helper::get_product_usage_notice_rules();
WC_Helper::get_product_usage_notice_rules() WC Helper::get product usage notice rules code WC 9.3.1
public static function get_product_usage_notice_rules() { $cache_key = '_woocommerce_helper_product_usage_notice_rules'; $data = get_transient( $cache_key ); if ( false !== $data ) { return $data; } $request = WC_Helper_API::get( 'product-usage-notice-rules', array( 'authenticated' => false, 'timeout' => 2, ) ); // Retry in 15 minutes for non-200 response. if ( wp_remote_retrieve_response_code( $request ) !== 200 ) { set_transient( $cache_key, array(), 15 * MINUTE_IN_SECONDS ); return array(); } $data = json_decode( wp_remote_retrieve_body( $request ), true ); if ( empty( $data ) || ! is_array( $data ) ) { $data = array(); } set_transient( $cache_key, $data, 1 * HOUR_IN_SECONDS ); return $data; }