WC_Product_Variable::get_variation_default_attribute( string $attribute_name )

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


Description Description


Parameters Parameters

$attribute_name

(Required) Attribute name.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-wc-product-variable.php

	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 ] : '';
	}

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.