Support

Account

Home Forums Backend Issues (wp-admin) How do I add WooCommerce Attributes? Reply To: How do I add WooCommerce Attributes?

  • I have done this very thing for a client (but for different reasons)…

    Here’s the code I used to display a WYSIWYG custom field in the attributes list:

    add_filter( 'woocommerce_get_product_attributes', 'ariel_display_recordings_attribute', 20 );
    function ariel_display_recordings_attribute( $attributes ) {
    	$ariel_recording_details = get_field('ariel_recording_details');
    	if (!empty(get_field('ariel_recording_details'))) {
    
    	$attribute = array(
    		'name'         => 'Recording',
    		'value'        => $ariel_recording_details,
    		'is_visible'   => '1',
    		'is_taxonomy'  => '0',
    		'is_variation' => '0',
    		'position'     => '0',
    	);
    
    	$attributes['ariel_recording_details'] = $attribute;
    	}
    
    	return $attributes;
    }

    You can also add additional code to attributes.php to specify what order you’d like attributes to appear in…