/**
  * Disables the gateway under any of these conditions:
  * 1) If the cart does not contain a pre-order
  * 2) If the pre-order amount is charged upfront
  * 3) On the pay page
  *
  * @since 1.0
  * @return bool
  */
 public function is_available()
 {
     $is_available = true;
     // Backwards compatibility checking for payment page
     if (function_exists('is_checkout_pay_page')) {
         $pay_page = is_checkout_pay_page();
     } else {
         $pay_page = is_page(woocommerce_get_page_id('pay'));
     }
     // on checkout page
     if (!$pay_page || defined('WOOCOMMERCE_CHECKOUT') && WOOCOMMERCE_CHECKOUT) {
         // not available if the cart does not contain a pre-order
         if (WC_Pre_Orders_Cart::cart_contains_pre_order()) {
             // not available when the pre-order amount is charged upfront
             if (WC_Pre_Orders_Product::product_is_charged_upfront(WC_Pre_Orders_Cart::get_pre_order_product())) {
                 $is_available = false;
             }
         } else {
             $is_available = false;
         }
     } else {
         // not available on the pay page (for now)
         $is_available = false;
     }
     return $is_available;
 }
 /**
  * Disables the gateway under any of these conditions:
  * 1) If the cart does not contain a pre-order
  * 2) If the pre-order amount is charged upfront
  * 3) On the pay page
  *
  * @since 1.0
  * @return bool
  */
 public function is_available()
 {
     $is_available = parent::is_available();
     // on checkout page
     if (!is_page(woocommerce_get_page_id('pay')) || defined('WOOCOMMERCE_CHECKOUT') && WOOCOMMERCE_CHECKOUT) {
         // not available if the cart does not contain a pre-order
         if (WC_Pre_Orders_Cart::cart_contains_pre_order()) {
             // not available when the pre-order amount is charged upfront
             if (WC_Pre_Orders_Product::product_is_charged_upfront(WC_Pre_Orders_Cart::get_pre_order_product())) {
                 $is_available = false;
             }
         } else {
             $is_available = false;
         }
     } else {
         // not available on the pay page (for now)
         $is_available = false;
     }
     return $is_available;
 }