0
私はWooの支払いゲートウェイを開発しており、カスタムフォームの送信にはwoocommerce_receipt_
フックを使用して、顧客を第三者Web支払いサービスにリダイレクトしてみます。なぜフックがうまくいかないのか?助けてくれてありがとう!乾杯!Woocommerceの領収書フックが正しく動作しません
これは私の支払いクラスコードです:
class my_vpos extends WC_Payment_Gateway {
function __construct() {
// The global ID for this Payment method
$this->id = "my_vpos";
$this->method_title = __("my_vpos", 'my_vpos');
$ this->method_description = __("Payment Gateway Plug-in for
WooCommerce", 'my_vpos');
$this->title = __("my_vpos", 'my_vpos');
$this->has_fields = false;
// This basically defines your settings which are then loaded with
init_settings()
$this->init_form_fields();
$this->title = $this->get_option('title');
$this->init_settings();
$this->testurl = 'https://www.exaple-payment.com/pay-gw-t/vpos';
$this->liveurl = 'https://www.exaple-payment.com/pay-gw-t/vpos';
// Actions
add_action('woocommerce_receipt_' . $this->id, array($this,
'receipt_page'));
} // End __construct()
function receipt_page($order){
echo '<form action="' . $this->testurl . '" method="post"
id="submit_payment_form">
<input type="hidden" name="type" value="PAYLOGIN"/>
</form>';
}
}
を追加します。助けを求めるタク – htmlbrewery
このコードを試してください add_action( 'woocommerce_receipt_my_vpos'、array(&$ this、 'receipt_page')、10、1); –
成功しません。「place order」ボタンをクリックした後に、サイト内エラー「Internal Server Error」が返されます。 – htmlbrewery