WC_Product_Variable::get_children( bool|string $visible_only = '' )

Return a products child ids.


Description Description

This is lazy loaded as it’s not used often and does require several queries.


Parameters Parameters

$visible_only

(Optional) Visible only.

Default value: ''


Top ↑

Return Return

(array) Children ids


Top ↑

Source Source

File: includes/class-wc-product-variable.php

	public function get_children( $visible_only = '' ) {
		if ( is_bool( $visible_only ) ) {
			wc_deprecated_argument( 'visible_only', '3.0', 'WC_Product_Variable::get_visible_children' );

			return $visible_only ? $this->get_visible_children() : $this->get_children();
		}

		if ( null === $this->children ) {
			$children = $this->data_store->read_children( $this );
			$this->set_children( $children['all'] );
			$this->set_visible_children( $children['visible'] );
		}

		return apply_filters( 'woocommerce_get_children', $this->children, $this, false );
	}


Top ↑

User Contributed Notes User Contributed Notes

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