I am using the WooCommerce Product Vendors plugin along with WooCommerce on a site. Within the plugin, there is a class in the file class-wc-product-vendors-commission.php
with the function calc_order_product_commission()
.
I need to modify what this function does, however, there are no hook/filters for this function. It is not a template file I can override in my theme. I believe I need to use good ol' fashioned PHP to extend the class function. Here is the code pertinent to the class and function:
class WC_Product_Vendors_Commission {
public $table_name;
protected $masspay;
/**
* Calculates the commission for a product based on an order
*
* @access public
* @since 2.0.0
* @version 2.0.0
* @param int $product_id
* @param int $vendor_id
* @param int $quantity
* @return float $commission
*/
public function calc_order_product_commission(
$product_id, $vendor_id, $product_amount, $quantity = 1 ) {
// HERE IS WHERE I NEED TO CHANGE WHAT THIS FUNCTION DOES
// AND MAKE COMMISSION A CUSTOM VALUE
return $commission;
}
}
How can I either extend this class in my functions.php
file or its own plugin to modify that function to do what I want? I do not want to edit the core plugin file.
THANKS!