[NSFW] Custom checkbox checked should be true but is false
-
Hi,
We have added a custom checkbox to Klarna checkout:
function add_omnisend_kco_checkbox( $additional_checkboxes ) {
$additional_checkboxes[] = array(
'id' => 'omnisend_kco_checkbox',
'text' => 'Hold meg oppdatert p? nyheter og tilbud.',
'checked' => false,
'required' => false,
);
return $additional_checkboxes;
}
add_filter( 'kco_additional_checkboxes', 'add_omnisend_kco_checkbox' );Using this callback function:
function kco_process_checkboxes( $order_id ) {
$klarna_order_id = get_post_meta( $order_id, '_transaction_id', true );
$klarna_order = KCO_WC()->api->get_klarna_order( $klarna_order_id );
if ( isset( $klarna_order['merchant_requested']['additional_checkboxes'] ) ) {
foreach ( $klarna_order['merchant_requested']['additional_checkboxes'] as $checkbox ) {
error_log(json_encode($checkbox));
}
}
}
add_action( 'kco_wc_payment_complete', 'kco_process_checkboxes' );The problem is that checked is always false:
[15-Aug-2024 12:36:39 UTC] {"id":"omnisend_kco_checkbox","checked":false}
The only way we made it work was by changing ‘checked’ => true, in add_omnisend_kco_checkbox. How can we fix this?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.