Advertisement
wpgenie

fix for bid input - Woodmart theme plus minus fix

May 5th, 2023 (edited)
1,040
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. /**
  2.  * Remove script wd-woocommerce-quantity for auction products for Woodmart theme, this code snippet should go to child theme's functions.php file
  3.  */
  4. function custom_enqueue_script() {
  5.     $product = wc_get_product( get_the_ID() );
  6.     if ( $product && $product->get_type() == 'auction') {
  7.         wp_add_inline_script( 'wd-woocommerce-quantity', 'jQuery(document).ready(function($) { woodmartThemeModule.$document.off("click", ".plus, .minus"); });');
  8.     }
  9. }
  10. add_action( 'wp_enqueue_scripts', 'custom_enqueue_script' , 9999 );
  11.  
  12.  
  13. /**
  14.  * Remove Woodmart's ajax_add_to_cart from auction single page, this code snippet should go to child theme's functions.php file
  15.  */
  16.  
  17. add_filter( 'woodmart_ajax_add_to_cart', 'custom_remove_add_ajax_to_cart', 10 );
  18. function custom_remove_add_ajax_to_cart ( $data ){
  19.     $product  = wc_get_product( get_the_ID() );
  20.     if ( is_product() ){
  21.         if ( $product && $product->is_type('auction') ){
  22.             return false;
  23.         }
  24.     }
  25.     return $data;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement