Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rajeshsingh520/bf98abfc82a997e4122d133352ddd007 to your computer and use it in GitHub Desktop.
Save rajeshsingh520/bf98abfc82a997e4122d133352ddd007 to your computer and use it in GitHub Desktop.
<?php
class pisol_marp_disable_dtt_plugin_options{
function __construct(){
add_filter('pisol_disable_dtt_completely', array($this, 'disableDateTimePlugin'));
}
function disableDateTimePlugin($value){
if(is_admin()) return;
$disable_for_product = array(636,637);
if(isset(WC()->cart)){
foreach( WC()->cart->get_cart() as $cart_item ) {
$product_in_cart = $cart_item['product_id'];
if(in_array($product_in_cart, $disable_for_product)){
$value = true;
}
}
}
return $value;
}
}
new pisol_marp_disable_dtt_plugin_options();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment