Guest User

Untitled

a guest
Aug 18th, 2019
69
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter('woocommerce_sale_flash', 'woo_custom_hide_sales_flash');
  2. function woo_custom_hide_sales_flash()
  3. {
  4. if ( is_user_logged_in() ) {
  5. return true;
  6. }
  7. return false;
  8. }
  9.  
  10. function sales_markup() {
  11.  
  12. if(!is_admin()) {
  13.  
  14. if(is_user_logged_in()) {
  15. // Instead of outputting add the markup that you want to show
  16. $output = '<div class="Sales_markup_here">
  17. </div>';
  18. return $output;
  19.  
  20. }
  21. }
  22. }
  23.  
  24. // use shortcode instead of action and then use shortcode anywhere you want to ouptut it
  25. add_shortcode( 'sales_markup', 'sales_markup' );
  26.  
  27. add_filter( 'woocommerce_sale_flash', 'filter_sales_flash_callback', 100, 3 );
  28. function filter_sales_flash_callback( $output_html, $post, $product )
  29. {
  30. if ( ! is_user_logged_in() ) {
  31. $output_html = false;
  32. }
  33. return $output_html;
  34. }
RAW Paste Data