There is a wordpress + woocommerce store. My question is: to get the price in the product section, use the get_price_html () output function. How to redefine it for variable goods in such a way that the price tag is not displayed in the form Range: old price - old price Range: new price - new price (ie, 120,000 rubles - 180,000 rubles, 90,000 rubles, 150,000 rubles)?
<div class="price"><del><span class="amount">120.000 руб.</span> –<span class="amount">180.000 руб.</span></del> <ins><span class="amount">90.000 руб.</span>– <span class="amount">150.000 руб.</span></ins></div> and depending on the variator switch, it adjusted to the single price value sought (1 position 90.000 rub., 2 position - 120.000 rub., 3 position - 150.000 rub.) Standard switch code:
<?php global $product, $post; if($product->product_type == 'variable') { $variable_products = array( 'available_variations' => $product->get_available_variations(), 'attributes' => $product->get_variation_attributes(), 'selected_attributes' => $product->get_variation_default_attributes() ); if ( ! empty( $variable_products['available_variations'] ) ) : ?> <table class="variations" cellspacing="0"> <tbody> <?php $loop=0 ; foreach ( $variable_products[ 'attributes'] as $name=>$options ) : $loop++; ?> <tr> <td class="label"> <label for="<?php echo sanitize_title($name); ?>"> <?php echo wc_attribute_label( $name ); ?> </label> </td> <td class="value"> <select id="<?php echo esc_attr( sanitize_title( $name ) ); ?>" name="attribute_<?php echo sanitize_title( $name ); ?>"> <?php if ( is_array( $options ) ) { if ( isset( $_REQUEST[ 'attribute_' . sanitize_title( $name ) ] ) ) { $selected_value=$ _REQUEST[ 'attribute_' . sanitize_title( $name ) ]; } elseif ( isset( $variable_products[ 'selected_attributes'][ sanitize_title( $name ) ] ) ) { $selected_value=$ variable_products[ 'selected_attributes'][ sanitize_title( $name ) ]; } else { $selected_value='' ; } // Get terms if this is a taxonomy - ordered if ( taxonomy_exists( sanitize_title( $name ) ) ) { $orderby=w c_attribute_orderby( sanitize_title( $name ) ); switch ( $orderby ) { case 'name' : $args=a rray( 'orderby'=>'name', 'hide_empty' => false, 'menu_order' => false ); break; case 'id' : $args = array( 'orderby' => 'id', 'order' => 'ASC', 'menu_order' => false, 'hide_empty' => false ); break; case 'menu_order' : $args = array( 'menu_order' => 'ASC', 'hide_empty' => false ); break; } $terms = get_terms( sanitize_title( $name ), $args ); foreach ( $terms as $term ) { if ( ! in_array( $term->slug, $options ) ) continue; echo ' <option value="' . esc_attr( $term->slug ) . '" ' . selected( sanitize_title( $selected_value ), sanitize_title( $term->slug ), false ) . '>' . apply_filters( 'woocommerce_variation_option_name', $term->name ) . '</option>'; } } else { foreach ( $options as $option ) { echo ' <option value="' . esc_attr( sanitize_title( $option ) ) . '" ' . selected( sanitize_title( $selected_value ), sanitize_title( $option ), false ) . '>' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option ) ) . '</option>'; } } } ?> </select> </td> </tr> <?php endforeach;?> </tbody> </table>