Esempio n. 1
0
 public function email_pay_now_button($order)
 {
     $type = $this->get_current_email_object();
     if ($type && $type->id == 'customer_processing_order') {
         WC_GZD_Checkout::instance()->add_payment_link($order->id);
     }
 }
                            $new[$key] = $custom_field;
                        }
                        $new[$name] = $field;
                    }
                }
            }
        }
        return !empty($new) ? $new : $fields;
    }
    public function save_fields($order_id)
    {
        $checkout = WC()->checkout();
        if (!empty($this->custom_fields)) {
            foreach ($this->custom_fields as $key => $custom_field) {
                if (!empty($custom_field['group']) && !isset($custom_field['override'])) {
                    foreach ($custom_field['group'] as $group) {
                        $val = isset($checkout->posted[$group . '_' . $key]) ? $checkout->posted[$group . '_' . $key] : '';
                        if ($group == 'shipping' || $group == 'billing') {
                            $val = $checkout->get_posted_address_data($key, $group);
                        }
                        if (!empty($val)) {
                            update_post_meta($order_id, '_' . $group . '_' . $key, sanitize_text_field($val));
                        }
                    }
                }
            }
        }
    }
}
WC_GZD_Checkout::instance();
 /**
  * Pay now button on success page
  */
 function woocommerce_gzd_template_order_pay_now_button($order_id)
 {
     WC_GZD_Checkout::instance()->add_payment_link($order_id);
 }