Wordpress cross-plugin refering

Hey.
I have no knowledge of PHP, but am trying to add some features to my Woocommerce website by fiddling with the .php files.
What I’m trying to accomplish is catching a ‘shop-orders’ variable from one plugin, which adds delivery time and date, and giving it to another plugin, which sends the order data to an email address.

Plugin 1


    /**
     * Display service details in Order Receipt from order meta
     *
     * @author FoodStore
     * @since 1.1
     * @return void
     */
    public function receipt_services_meta( $order ) {

        if( ! apply_filters( 'wfs_receipt_show_services', true ) ) 
            return;

        $order_id       = version_compare( WC_VERSION, '3.0.0', '<' ) ? $order->id : $order->get_id();
        $service_type   = get_post_meta( $order_id, '_wfs_service_type', true );
        $service_date   = get_post_meta( $order_id, '_wfs_service_date', true );
        $service_time   = get_post_meta( $order_id, '_wfs_service_time', true );

        $date_format    = get_option('date_format');

        echo '<tr>';
        echo '<td><strong>' . __( 'Service Type:', 'food-store' ) .'</strong></td>';
        echo '<td><strong>' . wfs_get_service_label( $service_type ) .'</strong></td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td><strong>' . __( 'Date:', 'food-store') . '</strong></td>';
        echo '<td><strong>' . date_i18n( $date_format, strtotime( $service_date ) ) . '</strong></td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td><strong>' . __( 'Time:', 'food-store' ) . '</strong></td>';
        echo '<td><strong>' . $service_time . '</strong></td>';
        echo '</tr>';
    }

Plugin 2

		function convert_template() {



			$defaults = array(
      'show_sku'      => false,
      'show_image'    => false,
      'image_size'    => array( 32, 32 ),
      'plain_text'    => true,
      'sent_to_admin' => false,
    );

		//	$this->placeholders['{woocommerce_email_order_meta}']    = $this->woocommerce_email_order_meta();
			$this->placeholders['{order_billing_name}']    = $this->object->get_billing_first_name() . ' ' . $this->object->get_billing_last_name();
			$this->placeholders['{email_order_items_table}']    = wc_get_email_order_items( $this->object , $defaults );
			$this->placeholders['{email_order_total_footer}']    = $this->email_order_total_footer();
			$this->placeholders['{order_billing_email}']    = $this->object->get_billing_email();
			$this->placeholders['{order_billing_phone}']    = $this->object->get_billing_phone();
			$this->placeholders['{email_addresses}']    = $this->get_email_addresses();
			$this->placeholders['{site_title}']    = get_bloginfo('name');
			$this->placeholders['{order_shipping_address_1}'] = $this->object->shipping_address_1;
			$this->placeholders['{order_shipping_city}'] = $this->object->shipping_city;
			$this->placeholders['{order_shipping_state}'] = WC()->countries->states[$this->object->billing_country][$this->object->billing_state];
 			$this->placeholders['{order_shipping_postcode}'] = $this->object->shipping_postcode;
 			$this->placeholders['{order_shipping_country}'] = WC()->countries->countries[ $this->object->get_shipping_country() ];
			// For old woocommerce use find and replace methods
			foreach ( $this->placeholders as $find => $replace ) {
				$this->find[]    = $find;
				$this->replace[] = $replace;
			}

			$this->placeholders = apply_filters( 'wcemails_find_placeholders', $this->placeholders, $this->object );

			// Legacy filters
			$this->find      = apply_filters( 'wcemails_find_placeholders', $this->find, $this->object );
			$this->replace   = apply_filters( 'wcemails_replace_placeholders', $this->replace, $this->object );

		}

I would like $service_time to be one of the placeholders in plugin 2.
What I’ve tried is this:

$this->placeholders[’{order_service_time}’] = receipt_services_meta( $service_time );

This failed.
I was hoping any one of you could quickly help me out here, since this may be just a 5 second job for someone who knows what they’re doing.

Thanks in advance!

Sponsor our Newsletter | Privacy Policy | Terms of Service