• Resolved ivan9506

    (@ivan9506)


    good day, I am trying to add a different price to my woocommerce products, I have a code that I have not been able to complete since if the products are variable and are in discount it does not show the value I want to assign, it also happens that in the products variables only show the lowest price and I need to show both prices.

    
    add_filter( 'woocommerce_get_price_html', 'change_displayed_sale_price_html', 10, 2 );
    function change_displayed_sale_price_html( $price, $product ) {
    
    global $product;{
    
     $regular_price = (float) $product->get_regular_price(); // Regular price
     $sale_price = (float) $product->get_price(); // Active price (the "Sale price" when on-sale)
    
     $precision = 0; // Max number of decimals
    
     $cuotapreciosale = round (($sale_price - ($sale_price / 100 * 4)), $precision);
     $price .= sprintf( __('<br><span style="font-size:15px;color:#d66d50;"></b> Con pedido Programado $%s</span>', 'woocommerce' ), number_format($cuotapreciosale, 0));
     
      }
    return $price;
    
    }
    

    I think I should add a jquery so that the price changes along with the selected variation but I am new to this and I do not know how to achieve it, I appreciate your help

    • This topic was modified 3 years, 10 months ago by ivan9506.
    • This topic was modified 3 years, 10 months ago by ivan9506.
    • This topic was modified 3 years, 10 months ago by Yui. Reason: please use CODE button for code formatting
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to add custom discounted price?’ is closed to new replies.