• Resolved Janet A

    (@janet_a)


    Ben:
    May I ask a email template question?
    I’d like to move the order meta up about the order information with a remove action / add action in the functions instead of editing the template.
    I have this but I know the priority numbers are not quite right.
    Do you have any tips?
    // remove_action( ‘woocommerce_email_order_meta’, array( $object, ‘order_meta’ ), 10, 3 );
    // add_action( ‘woocommerce_email_order_meta’, array( $object, ‘order_meta’ ), 5, 3 );

    Thanks!

    Janet

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey,
    Happy to help! Where are you wanting to move the order meta too? For example, are you trying to get it above the order details? Because if so you have to change the action.

    Ben

    Thread Starter Janet A

    (@janet_a)

    Yes, I’d like to know how to change the action to move the meta above the order details.

    Do I change the priority numbers?
    add_action( ‘woocommerce_email_order_meta’, array( $object, ‘order_meta’ ), 5, 3 );

    Thanks!

    So here is a function example:

    /**
     * Function to init actions for moveing the order meta in emails.
     */
    function custom_change_order_meta_order() {
    	if ( class_exists( 'WC_Emails' ) ) {
    		$wc_emails_instance = WC_Emails::instance();
    		remove_action( 'woocommerce_email_order_meta', array( $wc_emails_instance, 'order_meta' ), 10, 3 );
    		add_action( 'woocommerce_email_order_details', array( $wc_emails_instance, 'order_meta' ), 5, 3 );
    	}
    }
    add_action( 'init', 'custom_change_order_meta_order' );

    Ben

    Thread Starter Janet A

    (@janet_a)

    Thank you for providing this!
    Great support!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Move template elements’ is closed to new replies.