Merge pull request #5386 from splashingpixels/gateway-cod
gateway COD added instructions to email closes #5385
This commit is contained in:
commit
01d7e70168
|
@ -32,11 +32,14 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
|
||||||
// Get settings
|
// Get settings
|
||||||
$this->title = $this->get_option( 'title' );
|
$this->title = $this->get_option( 'title' );
|
||||||
$this->description = $this->get_option( 'description' );
|
$this->description = $this->get_option( 'description' );
|
||||||
$this->instructions = $this->get_option( 'instructions' );
|
$this->instructions = $this->get_option( 'instructions', $this->description );
|
||||||
$this->enable_for_methods = $this->get_option( 'enable_for_methods', array() );
|
$this->enable_for_methods = $this->get_option( 'enable_for_methods', array() );
|
||||||
|
|
||||||
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
||||||
add_action( 'woocommerce_thankyou_cod', array( $this, 'thankyou_page' ) );
|
add_action( 'woocommerce_thankyou_cod', array( $this, 'thankyou_page' ) );
|
||||||
|
|
||||||
|
// Customer Emails
|
||||||
|
add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,4 +216,20 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
|
||||||
if ( $this->instructions )
|
if ( $this->instructions )
|
||||||
echo wpautop( wptexturize( $this->instructions ) );
|
echo wpautop( wptexturize( $this->instructions ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add content to the WC emails.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param WC_Order $order
|
||||||
|
* @param bool $sent_to_admin
|
||||||
|
* @param bool $plain_text
|
||||||
|
*/
|
||||||
|
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
|
||||||
|
if ( $sent_to_admin || $order->payment_method !== 'cod' )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( $this->instructions )
|
||||||
|
echo wpautop( wptexturize( $this->instructions ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue