Answer the question
In order to leave comments, you need to log in
How to display the sale price and the usual price for variations side by side?
They are not a select, that's where I got the code from https://stackoverflow.com/questions/36219833/wooco... - a good alternative to plugins by the way, if there is no photo in each variation, if there is, then switchers are better.
I customized it for myself, and the part with variations is displayed like this
$radios .= '<div class="attr-container"><div class="radio-span d-flex"><div class="radio-button"><input type="radio" id="'.esc_attr($id).'" name="'.esc_attr($name).'" value="'.esc_attr($term->slug).'" '.checked(sanitize_title($args['selected']), $term->slug, false).'></div><div class="radio-label"><label for="'.esc_attr($id).'">'.esc_html(apply_filters('woocommerce_variation_option_name', $term->name)). '</label></div>' . !!!!!! . '</div></div>';
$price = get_post_meta( get_the_ID(), '_regular_price', true);
$sale = get_post_meta( get_the_ID(), '_price', true);
if (!empty($sale)){
echo $sale;
} else {
echo $price;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question