WordPress at Your Fingertips
function is not described

WC_Admin_Addons::get_section_data() public WC 1.0

Deprecated from version 5.9.0. It is no longer supported and can be removed in future releases. Use d in In-App Marketplace instead.

Get section content for the addons screen.

{} It's a method of the class: WC_Admin_Addons{}

Hooks from the method

Return

Array.

Usage

$result = WC_Admin_Addons::get_section_data( $section_id );
$section_id(string) (required)
Required section ID.

Changelog

Deprecated Since 5.9.0 No longer used in In-App Marketplace

Code of WC_Admin_Addons::get_section_data() WC 5.9.0

public static function get_section_data( $section_id ) {
	$section      = self::get_section( $section_id );
	$section_data = '';

	if ( ! empty( $section->endpoint ) ) {
		$section_data = get_transient( 'wc_addons_section_' . $section_id );
		if ( false === $section_data ) {
			$raw_section = wp_safe_remote_get( esc_url_raw( $section->endpoint ), array( 'user-agent' => 'WooCommerce Addons Page' ) );

			if ( ! is_wp_error( $raw_section ) ) {
				$section_data = json_decode( wp_remote_retrieve_body( $raw_section ) );

				if ( ! empty( $section_data->products ) ) {
					set_transient( 'wc_addons_section_' . $section_id, $section_data, WEEK_IN_SECONDS );
				}
			}
		}
	}

	return apply_filters( 'woocommerce_addons_section_data', $section_data->products, $section_id );
}