WordPress at Your Fingertips
function is not described

WC_Cart::get_cross_sells() public WC 1.0

Gets cross sells based on the items in the cart.

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

Hooks from the method
Return

Array. cross_sells (item ids)

Usage

$WC_Cart = new WC_Cart();
$WC_Cart->get_cross_sells();

Code of WC_Cart::get_cross_sells() WC 5.6.0

public function get_cross_sells() {
	$cross_sells = array();
	$in_cart     = array();
	if ( ! $this->is_empty() ) {
		foreach ( $this->get_cart() as $cart_item_key => $values ) {
			if ( $values['quantity'] > 0 ) {
				$cross_sells = array_merge( $values['data']->get_cross_sell_ids(), $cross_sells );
				$in_cart[]   = $values['product_id'];
			}
		}
	}
	$cross_sells = array_diff( $cross_sells, $in_cart );
	return apply_filters( 'woocommerce_cart_crosssell_ids', wp_parse_id_list( $cross_sells ), $this );
}