Automattic\WooCommerce\Blocks\BlockTypes

ProductSummary::create_anchorprivateWC 1.0

Create anchor element based on input.

Method of the class: ProductSummary{}

No Hooks.

Returns

String.

Usage

// private - for code of main (parent) class only
$result = $this->create_anchor( $product, $link_text );
$product(WC_Product) (required)
Product object.
$link_text(string) (required)
Link text.

ProductSummary::create_anchor() code WC 9.9.4

private function create_anchor( $product, $link_text ) {
	$href = esc_url( $product->get_permalink() );
	$text = wp_kses_post( $link_text );

	return '<a class="wp-block-woocommerce-product-summary__read_more" href="' . $href . '#tab-description">' . $text . '</a>';
}