1

Is their a plugin or code I can add to add a description field to custom product attributes in woocomerce variable subscription product.

I understand how to add it to the variation form but can't find anywhere to hook into the admin attributes forms.

How do I go about adding a description field per attribute?

Description field under values field in attribiutes admin

UPDATE I have added the following to my theme functions.php which gets it close in terms of rendering the field.

add_action( 'woocommerce_after_product_attribute_settings', 'mytheme_woo_add_custom_fields' );
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;

echo '<div class="options_group">';
// Textarea
woocommerce_wp_textarea_input(
    array(
        'id'          => 'decsription_textarea',
        'label'       => __( 'Description', 'woocommerce' ),
        'placeholder' => '',
        'desc_tip'    => true,
        'description' => __( "Here's some really helpful tooltip text.", "woocommerce" )
    )
 );

I'm now having trouble accessing a hook to save the custom field.

I have tried using the 'wp_ajax_woocommerce_save_attributes' hook as follows but my function doesn't fire on saving the attributes.

add_action('wp_ajax_woocommerce_save_attributes', 'mytheme_woo_save_attributes', 0);
 function mytheme_woo_save_attributes() {
    error_log('test save');     
}

What is the best hook and approach to use?

Barry Hamilton
  • 943
  • 3
  • 15
  • 35

0 Answers0