WC_AJAX::get_refreshed_fragments()public staticWC 1.0

Get a refreshed cart fragment, including the mini cart HTML.

Method of the class: WC_AJAX{}

Hooks from the method

Return

null. Nothing (null).

Usage

$result = WC_AJAX::get_refreshed_fragments();

WC_AJAX::get_refreshed_fragments() code WC 8.7.0

public static function get_refreshed_fragments() {
	ob_start();

	woocommerce_mini_cart();

	$mini_cart = ob_get_clean();

	$data = array(
		'fragments' => apply_filters(
			'woocommerce_add_to_cart_fragments',
			array(
				'div.widget_shopping_cart_content' => '<div class="widget_shopping_cart_content">' . $mini_cart . '</div>',
			)
		),
		'cart_hash' => WC()->cart->get_cart_hash(),
	);

	wp_send_json( $data );
}