Skip to content

Commit

Permalink
Add payment slip insertion when order status changed to the inital state
Browse files Browse the repository at this point in the history
  • Loading branch information
marlevak committed Feb 18, 2020
1 parent 81b8274 commit 61be479
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Wooplatnica.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ public function add_wooplatnica_gateway_class($methods)
*/
public function email_instructions($order, $sent_to_admin, $plain_text = false)
{
if (!$sent_to_admin && $this->domain === $order->get_payment_method() && $order->has_status('on-hold')) {
$initial_order_status = get_option("woocommerce_{$this->domain}_settings")['order_status'];
if (!$sent_to_admin && $this->domain === $order->get_payment_method() && $order->has_status($initial_order_status)) {
if ($this->options['instructions']) {
echo wpautop(wptexturize($this->options['instructions'])).PHP_EOL;
}
Expand All @@ -431,8 +432,9 @@ public function thankyou_page($order_id)
public function view_order_instructions($order_id) {
// Get an instance of the WC_Order object
$order = wc_get_order( $order_id );

if( $this->domain === $order->get_payment_method() && $order->has_status('on-hold')){

$initial_order_status = get_option("woocommerce_{$this->domain}_settings")['order_status'];
if( $this->domain === $order->get_payment_method() && $initial_order_status){
if ($this->options['instructions']) {
echo wpautop(wptexturize(wp_kses_post($this->options['instructions'])));
}
Expand Down

0 comments on commit 61be479

Please sign in to comment.