Advertisement
wpgenie

Simple Bulk Discount - remove action example

Feb 17th, 2022 (edited)
1,361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. /* visit us - https://wpgenie.org */
  2.  
  3. /*
  4. Simple Bulk Discount - remove action example
  5. this is code snippet should be used in your child theme functions.php or in your customization plugin
  6.  
  7. */
  8. function your_custom_bulk_discount_text(){
  9.    
  10.     global $post;
  11.            
  12.     $wcsbd_discount_text = get_post_meta( $post->ID, '_wcsbd_discount_text' , true );
  13.  
  14.     if( !empty( $wcsbd_discount_text ) ){
  15.         echo '<div class="your_custom_bulk_discount_text">';
  16.         echo apply_filters( 'the_content', $wcsbd_discount_text, $post->ID );      
  17.         echo '</div>';
  18.     }
  19. }
  20.  
  21.  
  22. add_action( 'template_redirect', 'template_redirect_action' );
  23.  
  24. function template_redirect_action() {
  25.    
  26.     global $Wc_Sbd;
  27.  
  28.     remove_action( 'woocommerce_single_product_summary',  array( $Wc_Sbd->plugin_public , 'bulk_discount_text' ), 45 );
  29.  
  30.     if ( is_product() ) {
  31.         add_action('woocommerce_single_product_summary', 'your_custom_bulk_discount_text', 44 );
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement