filter loop prices output

Viewing 1 post (of 1 total)
  • Author
  • #16876
    Admin & Mod

      if you need or want to change the price displayed – for example adding “from” to a price , or changing 0.00 to “free” or however else you’d like to display a particular price of a particular item you could use the following filter(s) in your theme’s functions.php.

      add_filter('wppizza_filter_loop_meta','myprefix_loop_price_filter', 10 ,2);
      function myprefix_loop_price_filter($meta, $post_id){
      change post_id as appropriate for the menu item 
      where you would like to change the output
      if($post_id==49 ){
      /* reinstate default */
      remove_filter('wppizza_filter_output_format_price', 'myprefix_item_price');
      return 	$meta;
      /** output the price as required */
      function myprefix_item_price($price){
      static $i=0;/* prices/sizes are zero indexed */
      $i==0 to only affect first price/size, $i==1 to only affect second price /size, and so on. omit if($i==xx) to change all prices 
      $price=__('from').' '.$price;/**change "from" / "price" as appropriate**/
      return $price;	
    Viewing 1 post (of 1 total)
    • The topic ‘filter loop prices output’ is closed to new replies.