WC_Product_Variation::get_weight( string $context = 'view' )
Returns the product’s weight.
Description Description
Parameters Parameters
- $context
-
(Optional) What the value is for. Valid values are view and edit.
Default value: 'view'
Return Return
(string)
Source Source
File: includes/class-wc-product-variation.php
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; }