1
0
mirror of synced 2025-03-23 16:43:52 +03:00

Add a check for the existence of a method in a class

This commit is contained in:
Dima Uryvskiy 2022-03-18 15:57:42 +03:00 committed by GitHub
parent 4a68135e33
commit 7f04fe822a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -632,7 +632,9 @@ if (!class_exists('WC_Retailcrm_Customers')) :
$new_customer = new WC_Customer();
foreach ($order->get_address('billing') as $prop => $value) {
$new_customer->{'set_billing_' . $prop}($value);
if (method_exists($new_customer, 'set_billing_' . $prop)) {
$new_customer->{'set_billing_' . $prop}($value);
}
}
$new_customer->set_first_name($order->get_billing_first_name());