WC_Product_Variable::get_variation_default_attribute()publicWC 1.0

If set, get the default attributes for a variable product.

Method of the class: WC_Product_Variable{}

No Hooks.

Return

String.

Usage

$WC_Product_Variable = new WC_Product_Variable();
$WC_Product_Variable->get_variation_default_attribute( $attribute_name );
$attribute_name(string) (required)
Attribute name.

WC_Product_Variable::get_variation_default_attribute() code WC 8.7.0

public function get_variation_default_attribute( $attribute_name ) {
	$defaults       = $this->get_default_attributes();
	$attribute_name = sanitize_title( $attribute_name );

	return isset( $defaults[ $attribute_name ] ) ? $defaults[ $attribute_name ] : '';
}