public function init_footer()
 {
     if (has_action('wp_footer', 'woocommerce_gzd_template_footer_vat_info')) {
         echo do_shortcode('[gzd_vat_info]');
     }
     if (has_action('wp_footer', 'woocommerce_gzd_template_footer_sale_info')) {
         echo do_shortcode('[gzd_sale_info]');
     }
     remove_action('wp_footer', 'woocommerce_gzd_template_footer_vat_info', wc_gzd_get_hook_priority('footer_vat_info'));
     remove_action('wp_footer', 'woocommerce_gzd_template_footer_sale_info', wc_gzd_get_hook_priority('footer_sale_info'));
 }
 public function set_order_email_filters($product)
 {
     if (is_wc_endpoint_url()) {
         return $product;
     }
     // Add order item name actions
     add_action('woocommerce_order_item_name', 'wc_gzd_cart_product_delivery_time', wc_gzd_get_hook_priority('email_product_delivery_time'), 2);
     add_action('woocommerce_order_item_name', 'wc_gzd_cart_product_item_desc', wc_gzd_get_hook_priority('email_product_item_desc'), 2);
     add_filter('woocommerce_order_formatted_line_subtotal', 'wc_gzd_cart_product_unit_price', wc_gzd_get_hook_priority('email_product_unit_price'), 2);
     return $product;
 }
 public function custom_hooks()
 {
     if (has_action('woocommerce_single_product_summary', 'woocommerce_gzd_template_single_price_unit')) {
         add_action('wc_gzdp_single_product_legal_price_info', 'woocommerce_gzd_template_single_price_unit', 0);
     }
     if (has_action('woocommerce_single_product_summary', 'woocommerce_gzd_template_single_legal_info')) {
         add_action('wc_gzdp_single_product_legal_price_info', 'woocommerce_gzd_template_single_legal_info', 1);
     }
     // Remove GZD Actions
     remove_action('woocommerce_single_product_summary', 'woocommerce_gzd_template_single_price_unit', wc_gzd_get_hook_priority('single_price_unit'));
     remove_action('woocommerce_single_product_summary', 'woocommerce_gzd_template_single_legal_info', wc_gzd_get_hook_priority('single_legal_info'));
     // Footer
     $this->footer_info();
     remove_action('wp_footer', 'woocommerce_gzd_template_footer_vat_info', wc_gzd_get_hook_priority('footer_vat_info'));
     remove_action('wp_footer', 'woocommerce_gzd_template_footer_sale_info', wc_gzd_get_hook_priority('footer_sale_info'));
 }
 public function custom_hooks()
 {
     if (has_action('woocommerce_after_shop_loop_item', 'woocommerce_gzd_template_single_shipping_costs_info')) {
         add_action('woocommerce_after_shop_loop_item_title', 'woocommerce_gzd_template_single_shipping_costs_info', wc_gzd_get_hook_priority('loop_shipping_costs_info'));
     }
     if (has_action('woocommerce_after_shop_loop_item', 'woocommerce_gzd_template_single_delivery_time_info')) {
         add_action('woocommerce_after_shop_loop_item_title', 'woocommerce_gzd_template_single_delivery_time_info', wc_gzd_get_hook_priority('loop_delivery_time_info'));
     }
     if (has_action('woocommerce_after_shop_loop_item', 'woocommerce_gzd_template_single_tax_info')) {
         add_action('woocommerce_after_shop_loop_item_title', 'woocommerce_gzd_template_single_tax_info', wc_gzd_get_hook_priority('loop_tax_info'));
     }
     remove_action('woocommerce_after_shop_loop_item', 'woocommerce_gzd_template_single_shipping_costs_info', wc_gzd_get_hook_priority('loop_shipping_costs_info', false));
     remove_action('woocommerce_after_shop_loop_item', 'woocommerce_gzd_template_single_delivery_time_info', wc_gzd_get_hook_priority('loop_delivery_time_info', false));
     remove_action('woocommerce_after_shop_loop_item', 'woocommerce_gzd_template_single_tax_info', wc_gzd_get_hook_priority('loop_tax_info', false));
     $this->footer_init();
     remove_action('wp_footer', 'woocommerce_gzd_template_footer_vat_info', wc_gzd_get_hook_priority('footer_vat_info'));
     remove_action('wp_footer', 'woocommerce_gzd_template_footer_sale_info', wc_gzd_get_hook_priority('footer_sale_info'));
 }
 public function custom_hooks()
 {
     // Single Product unit price + legal info
     if (has_action('woocommerce_single_product_summary', 'woocommerce_gzd_template_single_price_unit')) {
         add_action('wc_gzdp_single_product_legal_price_info', 'woocommerce_gzd_template_single_price_unit', 0);
     }
     if (has_action('woocommerce_single_product_summary', 'woocommerce_gzd_template_single_legal_info')) {
         add_action('wc_gzdp_single_product_legal_price_info', 'woocommerce_gzd_template_single_legal_info', 1);
     }
     // Remove GZD Actions
     remove_action('woocommerce_single_product_summary', 'woocommerce_gzd_template_single_price_unit', wc_gzd_get_hook_priority('single_price_unit'));
     remove_action('woocommerce_single_product_summary', 'woocommerce_gzd_template_single_legal_info', wc_gzd_get_hook_priority('single_legal_info'));
     // Loop legal info
     add_action('woocommerce_after_shop_loop_item', array($this, 'open_loop_wrapper'), wc_gzd_get_hook_priority('loop_tax_info') - 1);
     add_action('woocommerce_after_shop_loop_item', array($this, 'close_loop_wrapper'), wc_gzd_get_hook_priority('loop_delivery_time_info') + 1);
     // Footer info
     $this->footer_init();
     remove_action('wp_footer', 'woocommerce_gzd_template_footer_vat_info', wc_gzd_get_hook_priority('footer_vat_info'));
     remove_action('wp_footer', 'woocommerce_gzd_template_footer_sale_info', wc_gzd_get_hook_priority('footer_sale_info'));
 }
    /**
     * Constructor for the gateway.
     */
    public function __construct()
    {
        $this->id = 'direct-debit';
        $this->icon = apply_filters('woocommerce_gzd_direct_debit_icon', '');
        $this->has_fields = true;
        $this->method_title = __('Direct Debit', 'woocommerce-germanized');
        $this->method_description = __('Allows you to offer direct debit as a payment method to your customers. Adds SEPA fields to checkout.', 'woocommerce-germanized');
        // Load the settings.
        $this->init_form_fields();
        $this->init_settings();
        // Define user set variables
        $this->enabled = $this->get_option('enabled');
        $this->title = $this->get_option('title');
        $this->description = $this->get_option('description');
        $this->instructions = $this->get_option('instructions', $this->description);
        $this->enable_checkbox = $this->get_option('enable_checkbox', 'yes');
        $this->company_info = $this->get_option('company_info');
        $this->company_identification_number = $this->get_option('company_identification_number');
        $this->checkbox_label = $this->get_option('checkbox_label');
        $this->mandate_text = $this->get_option('mandate_text', __('[company_info]
debtee identification number: [company_identification_number]
mandat reference number: will be notified separately.

<h3>SEPA Direct Debit Mandate</h3>

I hereby authorize the payee to automatically draft from my savings account listed below for the specified amount. I further authorize my bank to accept the direct debit from this account.

Notice: I may request a full refund within eight weeks starting with the initial debiting date. Responsibilities agreed with my credit institute apply for a refund.

<strong>Debtor:</strong>
Account holder: [account_holder]
Street: [street]
Postcode: [postcode]
City: [city]
Country: [country]
IBAN: [account_iban]
BIC: [account_swift]

[city], [date], [account_holder]

This letter is done automatically and is valid without signature.

<hr/>

Please notice: Period for pre-information of the SEPA direct debit is shortened to one day.', 'woocommerce-germanized'));
        $this->supports = array('products');
        // Actions
        add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
        add_action('woocommerce_thankyou_direct-debit', array($this, 'thankyou_page'));
        add_action('wp_enqueue_scripts', array($this, 'payment_scripts'));
        add_action('woocommerce_review_order_after_payment', array($this, 'checkbox'), wc_gzd_get_hook_priority('checkout_direct_debit'));
        add_action('wp_ajax_show_direct_debit', array($this, 'generate_mandate'));
        add_action('wp_ajax_nopriv_show_direct_debit', array($this, 'generate_mandate'));
        add_filter('woocommerce_email_classes', array($this, 'add_email_template'));
        // Checkbox check
        add_action('woocommerce_after_checkout_validation', array($this, 'validate_checkbox'), 10, 1);
        // Order Meta
        add_action('woocommerce_checkout_update_order_meta', array($this, 'set_order_meta'), 10, 2);
        // Customer Emails
        add_action('woocommerce_email_before_order_table', array($this, 'email_instructions'), 10, 3);
        add_action('woocommerce_germanized_order_confirmation_sent', array($this, 'send_mail'));
        // Order admin
        add_filter('woocommerce_admin_billing_fields', array($this, 'set_debit_fields'));
    }
function woocommerce_gzd_checkout_load_ajax_relevant_hooks()
{
    if (is_ajax()) {
        return;
    }
    add_action('woocommerce_checkout_order_review', 'woocommerce_gzd_template_order_submit', wc_gzd_get_hook_priority('checkout_order_submit'));
    add_action('woocommerce_review_order_after_payment', 'woocommerce_gzd_template_checkout_legal', wc_gzd_get_hook_priority('checkout_legal'));
    add_action('woocommerce_review_order_after_payment', 'woocommerce_gzd_template_checkout_set_terms_manually', wc_gzd_get_hook_priority('checkout_set_terms'));
    if (get_option('woocommerce_gzd_checkout_legal_digital_checkbox') == 'yes') {
        add_action('woocommerce_review_order_after_payment', 'woocommerce_gzd_digital_checkbox', wc_gzd_get_hook_priority('checkout_digital_checkbox'));
    }
    // Add payment title heading
    add_action('woocommerce_review_order_before_payment', 'woocommerce_gzd_template_checkout_payment_title');
    remove_action('woocommerce_review_order_before_payment', 'woocommerce_gzd_template_checkout_payment_title');
}
 public function template_hooks()
 {
     if (get_option('woocommerce_gzdp_checkout_verify_data_output') == 'yes') {
         add_action('woocommerce_review_order_after_payment', array($this, 'order_step_data'), wc_gzd_get_hook_priority('checkout_legal') - 5);
     }
 }
 */
remove_action('woocommerce_order_details_after_order_table', 'woocommerce_order_again_button');
add_action('woocommerce_thankyou_order_received_text', 'woocommerce_gzd_template_order_success_text', 0, 1);
add_action('woocommerce_thankyou', 'woocommerce_gzd_template_order_pay_now_button', wc_gzd_get_hook_priority('order_pay_now_button'), 1);
add_action('woocommerce_order_item_quantity_html', 'wc_gzd_cart_product_delivery_time', wc_gzd_get_hook_priority('order_product_delivery_time'), 3);
add_action('woocommerce_order_item_quantity_html', 'wc_gzd_cart_product_item_desc', wc_gzd_get_hook_priority('order_product_item_desc'), 3);
add_filter('woocommerce_order_formatted_line_subtotal', 'wc_gzd_cart_product_unit_price', wc_gzd_get_hook_priority('order_product_unit_price'), 3);
if (get_option('woocommerce_gzd_hide_order_success_details') == 'yes') {
    remove_action('woocommerce_thankyou', 'woocommerce_order_details_table', WC_GZD_Hook_Priorities::instance()->get_priority('woocommerce_thankyou', 'woocommerce_order_details_table'));
}
if (get_option('woocommerce_gzd_trusted_shops_id')) {
    add_action('woocommerce_thankyou', 'woocommerce_gzd_template_checkout_thankyou_trusted_shops', 10, 1);
}
/**
 * Customer Account Creation
 */
if (get_option('woocommerce_gzd_customer_account_checkbox') == 'yes') {
    add_action('woocommerce_register_form', 'woocommerce_gzd_template_customer_account_checkbox', PHP_INT_MAX);
    add_filter('woocommerce_process_registration_errors', 'woocommerce_gzd_template_customer_account_checkbox_error', 10, 4);
}
/**
 * Footer
 */
if (get_option('woocommerce_gzd_display_footer_vat_notice') == 'yes') {
    add_action('woocommerce_gzd_footer_msg', 'woocommerce_gzd_template_footer_vat_info', wc_gzd_get_hook_priority('gzd_footer_vat_info'));
    add_action('wp_footer', 'woocommerce_gzd_template_footer_vat_info', wc_gzd_get_hook_priority('footer_vat_info'));
}
if (get_option('woocommerce_gzd_display_footer_sale_price_notice') == 'yes') {
    add_action('woocommerce_gzd_footer_msg', 'woocommerce_gzd_template_footer_sale_info', wc_gzd_get_hook_priority('gzd_footer_sale_info'));
    add_action('wp_footer', 'woocommerce_gzd_template_footer_sale_info', wc_gzd_get_hook_priority('footer_sale_info'));
}
 /**
  * Removes the cart item name filter (using checkout quantity html) if within checkout
  */
 function woocommerce_gzd_template_checkout_remove_cart_name_filter()
 {
     remove_filter('woocommerce_cart_item_name', 'wc_gzd_cart_product_units', wc_gzd_get_hook_priority('cart_product_units'), 2);
     remove_filter('woocommerce_cart_item_name', 'wc_gzd_cart_product_delivery_time', wc_gzd_get_hook_priority('cart_product_delivery_time'), 2);
     remove_filter('woocommerce_cart_item_name', 'wc_gzd_cart_product_item_desc', wc_gzd_get_hook_priority('cart_product_item_desc'), 2);
 }