how to add custom discounted price?
-
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
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.