WC_REST_Data_Currencies_Controller::get_currency()
Get currency information.
Method of the class: WC_REST_Data_Currencies_Controller{}
No Hooks.
Return
Array|Mixed
. Response data, ready for insertion into collection data.
Usage
$WC_REST_Data_Currencies_Controller = new WC_REST_Data_Currencies_Controller(); $WC_REST_Data_Currencies_Controller->get_currency( $code, $request );
- $code(string) (required)
- Currency code.
- $request(WP_REST_Request) (required)
- Request data.
WC_REST_Data_Currencies_Controller::get_currency() WC REST Data Currencies Controller::get currency code WC 9.7.1
public function get_currency( $code, $request ) { $currencies = get_woocommerce_currencies(); $data = array(); if ( ! array_key_exists( $code, $currencies ) ) { return false; } $currency = array( 'code' => $code, 'name' => $currencies[ $code ], 'symbol' => get_woocommerce_currency_symbol( $code ), ); return $currency; }