From e77d75588af987c63f62ddfeb6c4059a06178a51 Mon Sep 17 00:00:00 2001 From: ArthurThoby <49843789+ArthurThoby@users.noreply.github.com> Date: Thu, 13 Jun 2019 17:20:16 +0200 Subject: [PATCH] Add filter to the attribute name label Motivations: - other table fields are fully customizable thanks to the 'print_attribute_radio' function. - overriding the override of the plugin is not a stable and satisfactory solution. Potential use cases: - add a button to the right of the name to open a size guide. - enable a change in markup for the label itself (say you want to add js-classes to change the label on the fly depending on user interactions). - others I did not think about. Tested and works. --- templates/single-product/add-to-cart/variable.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/templates/single-product/add-to-cart/variable.php b/templates/single-product/add-to-cart/variable.php index 4158652..e8ec16b 100644 --- a/templates/single-product/add-to-cart/variable.php +++ b/templates/single-product/add-to-cart/variable.php @@ -30,7 +30,16 @@ $options ) : ?> - + + ' . wc_attribute_label( $name ) . ''; + echo wp_kses_post( apply_filters( + 'wc_variations_radio_buttons_attribute_name_label', + $attribute_name_label_html, + $name, + $options ) ); + ?> +