WC_API_Orders::item_is_null( array $item )

Helper method to check if the resource ID associated with the provided item is null


Description Description

Items can be deleted by setting the resource ID to null


Parameters Parameters

$item

(Required) item provided in the request body


Top ↑

Return Return

(bool) true if the item resource ID is null, false otherwise


Top ↑

Source Source

File: includes/legacy/api/v2/class-wc-api-orders.php

	protected function item_is_null( $item ) {

		$keys = array( 'product_id', 'method_id', 'title', 'code' );

		foreach ( $keys as $key ) {
			if ( array_key_exists( $key, $item ) && is_null( $item[ $key ] ) ) {
				return true;
			}
		}

		return false;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.2 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.