WC_Product_Variation::get_weight()publicWC 1.0

Returns the product's weight.

Method of the class: WC_Product_Variation{}

Hooks from the method

Return

String.

Usage

$WC_Product_Variation = new WC_Product_Variation();
$WC_Product_Variation->get_weight( $context );
$context(string)
What the value is for. Valid values are view and edit.
Default: 'view'

WC_Product_Variation::get_weight() code WC 8.7.0

public function get_weight( $context = 'view' ) {
	$value = $this->get_prop( 'weight', $context );

	// Inherit value from parent.
	if ( 'view' === $context && empty( $value ) ) {
		$value = apply_filters( $this->get_hook_prefix() . 'weight', $this->parent_data['weight'], $this );
	}
	return $value;
}