fetch the exchanged price to my mobile app
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from louai on December 20, 2023, 14:47hello
i am creating a mobile app using react native
i want to fetch the exchanged price as shown in my WordPress website
is there a library i can import it to my app or how could i fetch that exchanged or at least fetch the exchange price and multiply it to my products
or any other way pleas help...
hello
i am creating a mobile app using react native
i want to fetch the exchanged price as shown in my WordPress website
is there a library i can import it to my app or how could i fetch that exchanged or at least fetch the exchange price and multiply it to my products
or any other way pleas help...
Quote from Pablo Borysenco on December 21, 2023, 10:42Hello
You can get data about the current currency in this variable - woocs_current_currency
This stores an array. an example:
{"name":"EUR","rate":0.91019999980926513671875,"symbol":"Euro","position":"left","is_etalon":0,"hide_cents":0,"hide_on_front":0,"rate_plus":"","decimals":2,"separators":"0","description":"","flag":"http:\/\/site.pro\/wp-content\/plugins\/woocommerce-currency-switcher\/img\/no_flag.png"}
Hello
You can get data about the current currency in this variable - woocs_current_currency
This stores an array. an example:
{"name":"EUR","rate":0.91019999980926513671875,"symbol":"Euro","position":"left","is_etalon":0,"hide_cents":0,"hide_on_front":0,"rate_plus":"","decimals":2,"separators":"0","description":"","flag":"http:\/\/site.pro\/wp-content\/plugins\/woocommerce-currency-switcher\/img\/no_flag.png"}
Quote from louai on December 21, 2023, 12:59could u tell me what is the endpoint for the plugin so i can access it through WordPress API
tocall the variable and fetch the data
could u tell me what is the endpoint for the plugin so i can access it through WordPress API
tocall the variable and fetch the data
Quote from Pablo Borysenco on December 21, 2023, 13:27wp-json/woocs/v3/currency - to get data about all currencies
wp-json/woocs/v3/currency - to get data about all currencies
Quote from louai on December 26, 2023, 15:02thank you
another question in my react native app when i am creating orders through woo commerce API the price is not send in the Second currency here is my checkout component code
const Checkout = ({ navigation, cartItems }) => {const [name, setName] = useState("");const [number, setNumber] = useState("");const [billingInfo, setBillingInfo] = useState({firstName: "",lastName: "",address: "",city: "",// Include additional billing fields as needed});const handleOrderSubmit = async () => {// Perform the submission logic here, e.g., create an order with WooCommerce// Example implementation using axiostry {const currencyRate = await fetchCurrencyData();const lineItems = cartItems.map((item) => {const priceInCurrency = item.price * currencyRate; // Convert price to SYPreturn {product_id: item.id,quantity: item.quantity,price: priceInCurrency.toFixed(2), // Round the price to 2 decimal places};});// Prepare the order dataconst orderData = {billing: {first_name: billingInfo.firstName,last_name: billingInfo.lastName,address_1: billingInfo.address,city: billingInfo.city,// Include additional billing fields as needed},shipping: {first_name: billingInfo.firstName,last_name: billingInfo.lastName,address_1: billingInfo.address,city: billingInfo.city,// Include additional shipping fields as needed},line_items: lineItems,rate: currencyRate,currency: "SYP",shipping_lines: [{method_id: "local_pickup",method_title: "Local Pickup",},],payment_method: "cod",payment_method_title: "Cash on Delivery",status: "processing",};const authString = `${apiKey}:${apiSecret}`;const encodedAuth = Base64.encode(authString); // Encode the authentication stringconst response = await axios.post(`${apiUrl}/orders`, orderData, {headers: {Authorization: `Basic ${encodedAuth}`, // Include the authentication header},});// Handle the response as neededconsole.log("Order created:", response.data);// Optionally, you can navigate to a success screen or perform any other actionnavigation.navigate("OrderSuccess");} catch (error) {// Handle the errorconsole.error("Error creating order:", error);}};};in this case the order created IN the Second Currency SYP but the price still in USD with the SYP symbol which mean it is not multiplied by the ratecould u help me with that
thank you
another question in my react native app when i am creating orders through woo commerce API the price is not send in the Second currency here is my checkout component code
Quote from Pablo Borysenco on December 27, 2023, 10:28Hello
I'm not sure I understood you. But if you received product data using the API. You should prepare this data to create an order (convert prices) For this you have all the values - Current currency and a list of all currencies with rates
Hello
I'm not sure I understood you. But if you received product data using the API. You should prepare this data to create an order (convert prices) For this you have all the values - Current currency and a list of all currencies with rates
Quote from louai on December 27, 2023, 12:35I have a woocomerce website that have products with price , I'm using fox currency switcher to display the products with the another currency after multiply with the exchange rate .
in my react native application I'm using the woocomerce API to fetch the product with the prices ,i also fetched the currency rate and multiply it with the price to display it as the second currency .
my question is when I'am creating order in my app through app woocomerc API the order is created with the normal price , i need it to send with the second currency how
I have a woocomerce website that have products with price , I'm using fox currency switcher to display the products with the another currency after multiply with the exchange rate .
in my react native application I'm using the woocomerce API to fetch the product with the prices ,i also fetched the currency rate and multiply it with the price to display it as the second currency .
my question is when I'am creating order in my app through app woocomerc API the order is created with the normal price , i need it to send with the second currency how
Quote from Pablo Borysenco on December 27, 2023, 13:05I think it's better for you to ask in woocommerce support
Each order has a currency field, assign the current currency to this field
I think it's better for you to ask in woocommerce support
Each order has a currency field, assign the current currency to this field