Created
          April 9, 2014 05:15 
        
      - 
      
- 
        Save ChrisCree/10228143 to your computer and use it in GitHub Desktop. 
    Function to show original non-sale price in WooCommerce cart.
  
        
  
    
      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 characters
    
  
  
    
  | <?php | |
| // Do not copy opening PHP tag | |
| // Show non sale product price in cart | |
| add_filter( 'woocommerce_cart_item_price', 'wsm_show_nonsale_price', 10, 2 ); | |
| function wsm_show_nonsale_price( $newprice, $product ) { | |
| $_product = $product['data']; | |
| $saleprice = $_product->sale_price; | |
| if ( $saleprice > 0 ) { | |
| $newprice = ''; | |
| $newprice .= '<del><small style="color:#c9c9c9;">'; | |
| $newprice .= woocommerce_price( $_product->regular_price ); | |
| $newprice .= '</small></del> <strong>'; | |
| $newprice .= woocommerce_price( $_product->sale_price ); | |
| $newprice .= '</strong>'; | |
| return $newprice; | |
| } | |
| else { | |
| $newprice = woocommerce_price( $_product->price ); | |
| return $newprice; | |
| } | |
| } | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment