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…
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.