wpgenie icon

fix for bid input - Woodmart theme plus minus fix

wpgenie | PRO | 05/24/24 02:39:21 PM UTC (Edited) | 0 ⭐ | 1689 👁️ | Never ⏰ | []
PHP |

1 KB

|

None

|

0 👍

/

0 👎

/**
 * Remove script wd-woocommerce-quantity for auction products for Woodmart theme, this code snippet should go to child theme's functions.php file
 */
function custom_enqueue_script() {
    $product = wc_get_product( get_the_ID() );
    if ( $product && $product->get_type() == 'auction') {
        wp_add_inline_script( 'wd-woocommerce-quantity', 'jQuery(document).ready(function($) { woodmartThemeModule.$document.off("click", ".plus, .minus"); });');
    }
}
add_action( 'wp_enqueue_scripts', 'custom_enqueue_script' , 9999 );
 
 
/**
 * Remove Woodmart's ajax_add_to_cart from auction single page, this code snippet should go to child theme's functions.php file
 */
 
add_filter( 'woodmart_ajax_add_to_cart', 'custom_remove_add_ajax_to_cart', 10 );
function custom_remove_add_ajax_to_cart ( $data ){
    $product  = wc_get_product( get_the_ID() );
    if ( is_product() ){
        if ( $product && $product->is_type('auction') ){
            return false;
        }
    }
    return $data;
}

Comments