0
我正在为Woo开发支付网关,并尝试使用woocommerce_receipt_
挂钩提交自定义表单并将客户重定向到第三方网络支付服务。任何人都知道为什么钩子不起作用。感谢您的帮助!干杯!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>';
}
}
我有插件结构,但'woocommerce_receipt_my_vpos'不行。 Thaks帮助。 – htmlbrewery
尝试此代码 add_action('woocommerce_receipt_my_vpos',array(&$ this,'receipt_page'),10,1); –
没有成功,点击'下订单'按钮网站后出现错误'Internal Server Error' – htmlbrewery