Robert Granlund
asked on
Wordpress override a Class Method
I want to override a Class Method in Wordpress. Here is the class and Method
I want to override add_hooks
Here is what I have:
I receive an error: Fatal error: Class 'Woo_Os_Public' not found in wp-content/plugins/nda/nda -plugin.ph p on line 31
Line 31 is: class Wizard_class extends Woo_Os_Public {
if( !class_exists( 'Woo_Os_Public' ) ) { // If class not exist
class Woo_Os_Public {
public function add_hooks() {
// checkout process
add_action( 'woocommerce_checkout_process', array( $this, 'woo_os_checkout_field_process' ) );
}
}
}
I want to override add_hooks
Here is what I have:
if (!class_exists('Woo_Os_Public')) { // If class not exist
class Wizard_class extends Woo_Os_Public {
public function add_hooks() {
// add custom fields to checkout page
add_action('woocommerce_checkout_after_customer_details', array($this, 'woo_os_checkout_fields'));
}
}
}
$wizard_public = Woo_Os_Public();
$wizard_public->wizard = new Wizard_class;
I receive an error: Fatal error: Class 'Woo_Os_Public' not found in wp-content/plugins/nda/nda
Line 31 is: class Wizard_class extends Woo_Os_Public {
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER