Automattic\WooCommerce\Blocks\BlockTypes

AddToCartWithOptionsVariationSelector::get_variation_row()privateWC 1.0

Get variation row HTML.

Метод класса: AddToCartWithOptionsVariationSelector{}

Хуков нет.

Возвращает

Строку. Row HTML

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_variation_row( $product, $attribute_name, $options ): string;
$product(WC_Product) (обязательный)
Product instance.
$attribute_name(строка) (обязательный)
Attribute name.
$options(массив) (обязательный)
Attribute options.

Код AddToCartWithOptionsVariationSelector::get_variation_row() WC 9.8.5

private function get_variation_row( $product, $attribute_name, $options ): string {
	$html  = '<tr>';
	$html .= '<th class="label">' . $this->render_variation_label( $attribute_name ) . '</th>';
	$html .= '<td class="value">';
	$html .= $this->render_variation_selector( $product, $attribute_name, $options );
	$html .= '</td>';
	$html .= '</tr>';

	$variation_attributes = $product->get_variation_attributes();
	$attribute_keys       = array_keys( $variation_attributes );
	if ( end( $attribute_keys ) === $attribute_name ) {
		$html .= $this->get_reset_button_row();
	}

	return $html;
}