Resolved

attributes of simple products to be below the product title

Polestar Theme started by BUATON michel Sep 24, 2020 1 reply
BUATON michel Sep 24, 2020 · 11:57 am #14973

hello
I want the attributes of simple products to be below the product title and not in the “additional information” table.
thank you

Andrew Misplon Puro Sep 24, 2020 · 7:20 pm #14976

Hi Michel

Thanks for reaching out.

If you’d prefer to use email support, you’re welcome to do so. [email protected].

* Go to Plugins, search for and install a plugin called Code Snippets.
* Go to Snippets > Add New, name your snippet as you’d like, and insert into the snippet body:

/**
 * Remove product data tabs as required.
 */
function polestar_child_remove_product_tabs( $tabs ) {
	global $product;
	if ( $product->is_type( 'simple' ) ) {
		unset( $tabs['additional_information'] ); // Remove the additional information tab.
	}
	
	return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'polestar_child_remove_product_tabs', 98 );

/**
 * Displays product attributes before the Add to Cart form.
 */
function polestar_child_display_attributes() {
	global $product;
	if ( ! $product->is_type( 'simple' ) ) return;
	wc_display_product_attributes( $product );
}
add_action ( 'woocommerce_single_product_summary', 'polestar_child_display_attributes', 5 );

Set the snippet to run on the site front-end. Click the Save and Activate button.

Once the snippet is working, please, let me know if you need small styling/spacing adjustments, I’ll assist further from there.

Thanks

2 posts