Automattic\WooCommerce\Blocks\BlockTypes\AddToCartWithOptions
VariationSelectorAttribute::render
Render the block.
Method of the class: VariationSelectorAttribute{}
No Hooks.
Returns
String. Rendered block output.
Usage
// protected - for code of main (parent) or child class $result = $this->render( $attributes, $content, $block ): string;
- $attributes(array) (required)
- Block attributes.
- $content(string) (required)
- Block content.
- $block(WP_Block) (required)
- Block instance.
VariationSelectorAttribute::render() VariationSelectorAttribute::render code WC 10.7.0
protected function render( $attributes, $content, $block ): string {
global $product;
$content = '';
$product_attributes = $product->get_variation_attributes();
foreach ( $product_attributes as $product_attribute_name => $product_attribute_terms ) {
$content .= $this->get_product_row( $product_attribute_name, $product_attribute_terms, $block );
}
return $content;
}