Open Mantish opened 7 years ago
Came here looking for the same thing. A simple solution that's very easy to implement is to pass the variation ID to the woocommerce_variation_option_name
filter here https://github.com/8manos/wc-variations-radio-buttons/blob/master/templates/single-product/add-to-cart/variable.php#L25. That way we can add whatever variation specific data we want to each variation.
@Mantish, any thoughts of adding support for showing the price for each variation? @JiveDig, can you please explain how this can be done using your suggestion? Thanks!
Barely remember what I was going for, but based on my comment I think it means to change this:
$filtered_label = apply_filters( 'woocommerce_variation_option_name', $label );
to this:
$filtered_label = apply_filters( 'woocommerce_variation_option_name', $label, $id );
Thank your very much, but how would I go about showing the price for each variation using your code? I'm a Woocommerce rookie :-)
@yaniv691 I haven't made any progress to support this.
I think we would need to match the attribute to the corresponding variation in $available_variations
. Maybe using the woocommerce_variation_option_name
as JiveDig suggest, but it can also be coded as part of the print_attribute_radio
function.
The other way to do this is via Javascript. I haven't really look at how to do it, but it should be possible.
Anyway, I don't think there's a straightforward solution. Let us know if you make any progress.
This would only work for products with a single variable attribute, and we would probably need a setting to enable it