Skip to content

Commit

Permalink
Save riverty phone on pay page
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaymo committed Aug 1, 2024
1 parent 2583fb6 commit 97e7baa
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/PaymentMethods/Riverty.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,26 @@ public function filtersOnBuild()
);
add_action('woocommerce_rest_checkout_process_payment_with_context', [$this, 'addPhoneWhenRest'], 11);
add_action('woocommerce_rest_checkout_process_payment_with_context', [$this, 'addBirthdateWhenRest'], 11);
add_action('woocommerce_before_pay_action', [$this, 'fieldsMandatoryPayForOrder'], 11);
}

/**
* @param $order
*/
public function fieldsMandatoryPayForOrder($order)
{
$paymentMethod = filter_input(INPUT_POST, 'payment_method', FILTER_SANITIZE_SPECIAL_CHARS) ?? false;

if ($paymentMethod !== 'mollie_wc_gateway_riverty') {
return;
}

$phoneValue = filter_input(INPUT_POST, 'billing_phone_riverty', FILTER_SANITIZE_SPECIAL_CHARS) ?? false;
$phoneValid = $phoneValue || null;

if ($phoneValid) {
$order->set_billing_phone($phoneValue);
}
}

public function switchFields($data)
Expand Down

0 comments on commit 97e7baa

Please sign in to comment.