Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'woocommerce_variable_sale_price_html', 'wc_shopy_variation_price_format', 10, 2 );
- add_filter( 'woocommerce_variable_price_html', 'wc_wc_shopy_variation_price_format', 10, 2 );
- function wc_shopy_variation_price_format( $price, $product ) {
- $min_price = $product->get_variation_price( 'min', true );
- if ( $product->product_type == 'variable' && is_product_category( 'promotions' ) ) {
- $available_variations = $product->get_available_variations();
- for ($i = 0; $i < count($available_variations); ++$i) {
- $variation_id = $available_variations[$i]['variation_id'];
- $variable_product1 = new WC_Product_Variation($variation_id);
- $regular_price = $variable_product1->regular_price;
- }
- $price = sprintf( __( 'A partir de %1$s <ins>%2$s</ins>', 'woocommerce' ), wc_price( $regular_price ) , wc_price( $min_price ) );
- } else {
- $price = sprintf( __( 'A partir de %1$s', 'woocommerce' ), wc_price( $min_price ) );
- }
- return $price;
- }
Advertisement
Add Comment
Please, Sign In to add comment