Link to home
Start Free TrialLog in
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

Overwrite Wordpress Function

I want to overwrite / replace a Wordpress, WooCommerce function.

This is what I have:
class WC_Meta_Box_Order_Items {

	/**
	 * Output the metabox
	 */
	public static function output( $post ) {
		global $thepostid, $theorder;

		if ( ! is_object( $theorder ) ) {
			$theorder = wc_get_order( $thepostid );
		}

		$order = $theorder;
		$data  = get_post_meta( $post->ID );

		include( 'views/html-order-items.php' );
	}
}

Open in new window


I want to replace:       public static function output( $post ) {
with:       public static function myPersonalOutput( $post ) {
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Where is this class defined?
SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Robert Granlund

ASKER

Ultimately what I am trying to do is to "hook" in from outside of WooCommerce through a custom-functions.php and replace this line:
include( 'views/html-order-items.php' );

with:
includes('MY_DIRECTORY/views/html-order-items.php');