Flycart woo discount rules function remove
Question
I am using woo discount rules plugin pro, and it has a function to add a change variant button in the cart page of woocomerce. I don’t want the change variant button there. There are no settings to overide this in the function. I have found the function in the plugin that I would like to remove. How would I go about doing this.
Here is the plugin function
/**
* Display option to change product in cart
*
* @param $product_id int
* @param $customer_product_choice array
* */
public static function displayOptionToChangeProduct($product_id, $customer_product_choice){
//TODO: Display in right format
if(isset($customer_product_choice['available_products']) && !empty($customer_product_choice['available_products'])){
$template_helper = new Template();
$available_products = $customer_product_choice['available_products'];
$override_path = get_theme_file_path('woo-discount-rules-pro/buy-x-get-y-select-auto-add-variant.php');
$variant_select_box_template_path = WDR_PRO_PLUGIN_PATH . 'App/Views/Templates/buy-x-get-y-select-auto-add-variant.php';
if (file_exists($override_path)) {
$variant_select_box_template_path = $override_path;
}
$template_helper->setPath($variant_select_box_template_path)->setData(array('available_products' => $available_products, 'customer_product_choice' => $customer_product_choice, 'woocommerce' => new Woocommerce()))->display();
}
}
Here is how I tried to remove it in my functions.php file
add_action('plugins_loaded','remove_change_variant');
function remove_change_variant() {
if (class_exists('WDR_PRO')) {
remove_action( 'wp_enqueue_scripts', array( WDR_PRO::get_instance(), 'displayOptionToChangeProduct' ) );
}
}
Not quite sure what I may be doing wrong, any help would be greatly appreciated.
0
3 months
0 Answers
13 views
0
Leave an answer
You must login or register to add a new answer .