Automattic\WooCommerce\Gateways\PayPal
Buttons::get_client_id
Get the client-id for the PayPal buttons.
Метод класса: Buttons{}
Хуков нет.
Возвращает
string|null. The PayPal client-id, or null if the request fails.
Использование
$Buttons = new Buttons(); $Buttons->get_client_id(): ?string;
Список изменений
| С версии 10.5.0 | Введена. |
Код Buttons::get_client_id() Buttons::get client id WC 11.2.2
public function get_client_id(): ?string {
if ( ! $this->gateway->should_use_orders_v2() ) {
return null;
}
$option_key = self::CLIENT_ID_OPTION . ( $this->gateway->testmode ? '_sandbox' : '_live' );
$client_id = get_option( $option_key, null );
if ( empty( $client_id ) ) {
$client_id = $this->request->fetch_paypal_client_id();
if ( empty( $client_id ) ) {
return null;
}
update_option( $option_key, $client_id );
}
return $client_id;
}