WC_Product_Variable::child_has_weight()publicWC 1.0

Does a child have a weight set?

Method of the class: WC_Product_Variable{}

No Hooks.

Return

true|false.

Usage

$WC_Product_Variable = new WC_Product_Variable();
$WC_Product_Variable->child_has_weight();

WC_Product_Variable::child_has_weight() code WC 9.4.2

public function child_has_weight() {
	$transient_name = 'wc_child_has_weight_' . $this->get_id();
	$has_weight     = get_transient( $transient_name );

	if ( false === $has_weight ) {
		$has_weight = $this->data_store->child_has_weight( $this );
		set_transient( $transient_name, (int) $has_weight, DAY_IN_SECONDS * 30 );
	}

	return (bool) $has_weight;
}