Advertisement
Fany_VanDaal

Úprava zobrazení ceny

Nov 10th, 2022
851
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. add_filter( 'woocommerce_get_price_html', 'ts_custom_price', 10, 2 );
  2. function ts_custom_price() {
  3.     global $product;
  4.  
  5.   if ($product->is_on_sale())
  6.   {
  7.   if( $product->is_type('simple') || $product->is_type('external') || $product->is_type('grouped') ) {
  8.     $regular_price   = get_post_meta( $product->get_id(), '_regular_price', true );
  9.         $sale_price   = get_post_meta( $product->get_id(), '_sale_price', true );
  10.    
  11.       if( !empty($sale_price) ) {
  12.       echo '<h4 class="cana_pred_slevou"><small><strong>Před slevou:</strong></small> '.$regular_price.'</h4><h3 class="cena_po_sleve"><strong>Po slevě:</strong> '.$sale_price.'</h3>';
  13.     }
  14.   }  
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement