Automattic\WooCommerce\Internal\Admin\Notes

WooSubscriptionsNotes::get_product_id_from_subscription_note()publicWC 1.0

Gets the product_id (if any) associated with a note.

Method of the class: WooSubscriptionsNotes{}

No Hooks.

Return

Int|false.

Usage

$WooSubscriptionsNotes = new WooSubscriptionsNotes();
$WooSubscriptionsNotes->get_product_id_from_subscription_note( $note );
$note(Note) (required) (passed by reference — &)
The note object to interrogate.

WooSubscriptionsNotes::get_product_id_from_subscription_note() code WC 8.7.0

public function get_product_id_from_subscription_note( &$note ) {
	$content_data = $note->get_content_data();

	if ( property_exists( $content_data, 'product_id' ) ) {
		return intval( $content_data->product_id );
	}

	return false;
}