2017-05-29 67 views
0

什麼是正確的方式鉤入WC_Gateway_PayPal_Pro結賬信用卡表格實現jquery.payment功能的自定義主題?WooCommerce PayPal Pro jquery.payment結算表格改進

ENV是跟上時代的使用:

  • WooCommerce v3.0.7
  • WooCommerce貝寶臨(經典和PayFlow版)網關v4.4.6

jquery.payment附帶WooCommerce和根據this article(...可能已過時)啓用它是恢復到默認WC credit_card_form的問題。

現在,我管理使用工作jquery.payment輸入顯示形式「的functions.php」以下內容:

function filter_woocommerce_payment_gateway_supports($var, $feature, $instance) { 

    $feature = 'default_credit_card_form'; 

    return $feature; 
} 
add_filter('woocommerce_payment_gateway_supports', 'filter_woocommerce_payment_gateway_supports', 10, 3) 

但是,這還遠遠工作(沒有料到自己會那麼容易),它只是不會驗證。錯誤範圍包括:

Payment error: There was a problem connecting to the payment gateway. 
Payment error: Security header is not valid 
Card expiration date is invalid 

我覺得我失去了,按照文章,被「修改表單處理......確保網關尋找正確後的數據」,但如何?找不到下列行爲有關的任何相關文件,以便尋找不勝感激指針:

woocommerce_credit_card_form_args 
woocommerce_credit_card_form_fields 
woocommerce_credit_card_form_start 
woocommerce_credit_card_form_end 

回答

0

最容易完成,這是enque WC的credit-card-form.js腳本:

/* 
* Enques credit-card-form.min.js to provide 
* better Credit Card form validation 
*/ 
function filter_woocommerce_enqueue_styles($return_false) { 
    if (function_exists('is_checkout')) { 
     if (is_checkout()) { 
      $WC_credit_card_form = plugins_url('woocommerce/assets/js/frontend/credit-card-form.min.js'); 
      wp_enqueue_script('wc-credit-card-form', $WC_credit_card_form, ['jquery', 'jquery-payment'], null, true); 
     } 
    } 
} 
add_filter('woocommerce_enqueue_styles', 'filter_woocommerce_enqueue_styles', 10, 1);