• Resolved nirof

    (@nirof)


    hello,
    I want to add custom fields to the Additional Information tab
    I found this code that does it perfectly

    function yourprefix_woocommerce_display_product_attributes($product_attributes, $product){
    	$product_attributes['customfield'] = [
    		'label'	=> __('custom', 'text-domain'),
    		'value' => get_post_meta($product->get_ID(), 'customfield', true),
    	];
    	return $product_attributes;
    }
    add_filter('woocommerce_display_product_attributes', 'yourprefix_woocommerce_display_product_attributes', 10, 2);

    is it possible to change it so it would show the field label instead of the value of the field?

    e.g
    value: red
    label: the color red

    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there 👋

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers!

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom Field to Additional Information’ is closed to new replies.