Support is closed now. We shall check all on 20th May 2024.

Premium add-on for Bricks Builder

Add aria-label attribute to Mini Cart link

The Mini Cart element of Bricks Builder is not adding the aria-label property to the anchor link. But you can add it with a small PHP code. Open the functions.php file of the bricks child theme or put the code in your 3rd party snippets plugin.

add_filter( 'bricks/element/render_attributes', 'bu_minicart_link_aria_label', 10, 3 );
function bu_minicart_link_aria_label( $attributes, $key, $element_instance ) {
	if( $element_instance->name == 'woocommerce-mini-cart' && $key == 'a' ) {
		$attributes['a']['aria-label'] = 'ENETERARIALABEL';

	return $attributes;

Replace the ENTERARIALABEL text in the above code with your valid aria-label text.

Explanation: Bricks have filter bricks/element/render_attributes. So you can add your own custom attributes to any HTML markup. Here I used this filter. This filter is accepting the 3 parameters: attributes in array type, key in string type, and element_instance in object type. I do not want to apply this code to every element. So I added an IF statement and checked that it is a mini cart element and ‘a’ anchor HTML tag. Then I am adding my own custom attribute to it.

Fills In: 

Leave the first comment

Search Tutorials

Request TutorialsFeatures Request