Revert get_featured method
This commit is contained in:
parent
05d774cdb5
commit
7cbdd71af6
|
@ -21,6 +21,45 @@ class WC_Admin_Addons {
|
|||
/**
|
||||
* Get featured for the addons screen
|
||||
*
|
||||
* @deprecated 5.9.0 No longer used in In-App Marketplace
|
||||
*
|
||||
* @return array of objects
|
||||
*/
|
||||
public static function get_featured() {
|
||||
$featured = get_transient( 'wc_addons_featured' );
|
||||
if ( false === $featured ) {
|
||||
$headers = array();
|
||||
$auth = WC_Helper_Options::get( 'auth' );
|
||||
|
||||
if ( ! empty( $auth['access_token'] ) ) {
|
||||
$headers['Authorization'] = 'Bearer ' . $auth['access_token'];
|
||||
}
|
||||
|
||||
$raw_featured = wp_safe_remote_get(
|
||||
'https://woocommerce.com/wp-json/wccom-extensions/1.0/featured',
|
||||
array(
|
||||
'headers' => $headers,
|
||||
'user-agent' => 'WooCommerce Addons Page',
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! is_wp_error( $raw_featured ) ) {
|
||||
$featured = json_decode( wp_remote_retrieve_body( $raw_featured ) );
|
||||
if ( $featured ) {
|
||||
set_transient( 'wc_addons_featured', $featured, DAY_IN_SECONDS );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_object( $featured ) ) {
|
||||
self::output_featured_sections( $featured->sections );
|
||||
return $featured;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render featured products and banners using WCCOM's the Featured 2.0 Endpoint
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function render_featured() {
|
||||
|
|
Loading…
Reference in New Issue