WC_Product::set_weight()publicWC 3.0.0

Set the product's weight.

Method of the class: WC_Product{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Product = new WC_Product();
$WC_Product->set_weight( $weight );
$weight(float|string) (required)
Total weight.

Changelog

Since 3.0.0 Introduced.

WC_Product::set_weight() code WC 8.7.0

public function set_weight( $weight ) {
	$this->set_prop( 'weight', '' === $weight ? '' : wc_format_decimal( $weight ) );
}