php - Get WooCommerce custom payment gateway values in process_payment function for Blocks checkout - Stack Overflow
- c - Solaris 10 make Error code 1 Fatal Error when trying to build python 2.7.16 - Stack Overflow 推荐度:
- javascript - How to dismiss a phonegap notification programmatically - Stack Overflow 推荐度:
- javascript - Get the JSON objects that are not present in another array - Stack Overflow 推荐度:
- javascript - VS 2015 Angular 2 import modules cannot be resolved - Stack Overflow 推荐度:
- javascript - Type 'undefined' is not assignable to type 'menuItemProps[]' - Stack Overflow 推荐度:
- 相关推荐
I am creating custom payment plugin for woocommerce. I am facing issue while getting the checkout form data in process_payment
function of woocommerce payment class.
I am using following JS code to make payment gateway compatible with woocommerce Block checkout.
const PaySettings= window.wc.wcSettings.allSettings.paymentMethodData.pay;
const Paylabel = window.wp.htmlEntities.decodeEntities( PaySettings.title );
const PayMethod = ({ id, label,value }) => {
return React.createElement('div', {className: 'pay-methods'},
React.createElement('label', {htmlFor: id}, label),
React.createElement('input', {type: 'radio', name: id, value: value, onChange: (e) => e.target.value}),
);
};
const Content = () => {
return React.createElement('div', {className: 'pay-methods-cont'}, null,
React.createElement('img', {src: PaySettings.icon}),
React.createElement('p', null, window.wp.htmlEntities.decodeEntities(PaySettings.description || '')),
React.createElement(PayMethod, {id: 'pay_method', label: 'JazzCash',value: 'jazzcash' }),
React.createElement(PayMethod, {id: 'pay_method', label: 'EasyPaisa',value: 'easypaisa' })
);
}
const Icon = () => {
return React.createElement('div', {className: 'custom-input-field'},
React.createElement('img', {src: PaySettings.icon}))
}
const AP_Gateway = {
name: 'pay',
label: Paylabel,
icon: Icon,
content: Object(window.wp.element.createElement)(Content, null),
edit: Object(window.wp.element.createElement)(Content, null),
canMakePayment: () => true,
ariaLabel: Paylabel,
supports: {
features: ['products'],//settings.supports,
},
};
window.wc.wcBlocksRegistry.registerPaymentMethod( AP_Gateway )
It is showing radio options on checkout as payment gateway options but when I select any of the option I am not able to receive value in process_payment function.
public function process_payment( $order_id ) {
echo "<pre>";print_r($_POST);echo "</pre>";die;
}
I am doing something wrong or missing something ? Please help.
最新文章
- 暴风影音“猝死”,一个PC播放器时代的终结
- 成本高、厂商疑 微软Surface面临十大风险
- Intel毫不客气:ARM+Win8软硬件都不行
- [连载]巨头“心血之作”终失败(三):诺基亚N9
- Can I Trigger Console Application From Window Service in Visual Studio c#? - Stack Overflow
- typescript - Not able to make firstValueFromasync work with Angular - Stack Overflow
- flutter - having issue about qr code scanner that can scan almost everything - Stack Overflow
- gdal - Using gdal_translate to compress multiple TIFF files - Stack Overflow
- python - How to explicitly define a function's domain in sympy - Stack Overflow
- youtube - How to disable the Page Visibility API of react native webview? - Stack Overflow
- ios - How should I replace semaphores in my SwiftHealthKit app? - Stack Overflow
- laravel - Customizing Fortify for Multi-Tenant Password Resets Tokens with Domain-Specific Tokens - Stack Overflow
- web - Framer Motion Scrollable - Stack Overflow
- artificial intelligence - ImportError in Python when using the phi library - Stack Overflow
- GitHub disallow merge and rebase commits for multiple repositories - Stack Overflow
- ace - Does JSONEditor have a default function to get the JSON block from the cursor position? - Stack Overflow
- lean - Lean4 good way to solve `imports are out of date` - Stack Overflow