Home › Forums › Legacy Support › Support queries › Other issues › Parcels in price (10x 12.90)
Tagged: parcels, Price, Price parcels
- This topic has 5 replies, 3 voices, and was last updated 2 years, 8 months ago by Veronica.
Viewing 6 posts - 1 through 6 (of 6 total)
-
AuthorPosts
-
February 2, 2022 at 7:23 pm #379229marcelodidierSpectatorI need a function to put parcels in price and the final price. I have found a plugin to do that but no sincronize with WPLMS price. Just only a Woocommerce price. http://3.19.56.76 http://3.19.56.76/shop/ - This is ok! But not work in home. I try this but not work: /** * Custom simple product price format. * * Adds credit cart parcels in price html. * * @param string $price Old price format. * * @return string Price format with credit card parcels. */ function cs_custom_simple_product_price_html( $price ) { global $product; $parcels = 12; // Edit the number of parcels here! $parcel_price = $product->get_price() / 12; $html = '<span class="parcels">' . $parcels . 'x </span>'; $html .= wc_price( $parcel_price ) . '<br />'; $html .= '<span class="without-interest">' . __( 'sem juros' ) . '</span><br />'; $html .= wc_price( $product->get_price() ); return $html; } add_filter( 'wc_price_html', 'cs_custom_simple_product_price_html' );February 3, 2022 at 2:55 pm #379286Anshuman SahuKeymasterWe are using this code :
to fetch and show the pricing there . Please check if your custom code works with this or not. you need to use this filter : apply_filters( 'woocommerce_get_price_html', $price, $this );$product = wc_get_product( $product_id ); $product->get_price_html()
February 3, 2022 at 3:37 pm #379291marcelodidierSpectatorThis reply has been marked as private.February 4, 2022 at 3:48 pm #379377Anshuman SahuKeymasterTry out this code :add_filter('woocommerce_get_price_html',function($price,$product){ $parcels = 12; // Edit the number of parcels here! $parcel_price = $product->get_price() / 12; $html = '<span class=”parcels”>' . $parcels . 'x </span>'; $html .= wc_price( $parcel_price ) . '<br />'; $price .= '<span class=”without-interest”>' . __( 'sem juros' ) . '</span><br />'; return $price; },10,2);
February 4, 2022 at 10:27 pm #379412marcelodidierSpectatorI made a few small adjustments to work and it worked. add_filter('woocommerce_get_price_html',function($price,$product){ $parcels = 12; // Edit the number of parcels here! $parcel_price = $product->get_price() / 12; $html = '<span class=”parcels”>' . $parcels . 'x </span>'; $html .= wc_price( $parcel_price ) . '<br />'; $price .= '<span class=”without-interest”>' . __( ' sem juros' ) . '</span><br />'; return '<span class=”parcels”>' . $parcels . 'x </span>' . wc_price( $parcel_price ) . ' ou <br />' . $price; },10,2); Thank you so much for your attention and support!February 5, 2022 at 9:49 am #379432VeronicaModeratorappreciate this thanks for your confirmation -
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)
- The topic ‘Parcels in price (10x 12.90)’ is closed to new replies.