Created
December 8, 2020 23:56
-
-
Save dsebao/af987b1fa250a18e72b319f2a7ce1fad to your computer and use it in GitHub Desktop.
Revisions
-
dsebao created this gist
Dec 8, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ <?php add_filter('woocommerce_get_price_html', 'custom_price_message', 100, 2); function custom_price_message($price, $product) { //aca se podria realizar diferentes acciones dependiendo del tipo de producto, es solo de muestra if ($product->get_type() === 'simple') { } //ACA EMPIEZA EL SNIPPET $nuevoprecio = ''; //Obtengo el precio del producto $price = $product->get_price(); //Obtengo las cuotas $precio_en_cuotas = wc_price($price / 12); // Acá fijate si querés con decimales o redondo. //Comparo si hay algun descuento aplicado y si lo hay lo muestro tachado if($price != $product->get_regular_price()){ $nuevoprecio .= "<del>" . wc_price($product->get_regular_price()) . "</del> "; } //Agrego las cuotas correspondientes $nuevoprecio .= wc_price($price) . ' <br><span class="custom-price-prefix">' . __('<b>Hasta 12 Cuotas sin interés de</b> ') . $precio_en_cuotas . '</span>'; //retorno el snippet html resultanto return $nuevoprecio; }