• Resolved descomputers

    (@descomputers)


    Hi

    I have recently taken over management of this site and one of the things that seems to be a constant issue is getting the correct currency symbol to apply.

    We have an instance of WooCommerce running in one site with a custom plugin being used to access data from there in other (linked) sites via the Woocommerce API.

    When listing products using the WooCommerce API, while they include the JSON property “meta_data” in the response, nothing is populated there (and based on information I’ve found in Google searches they have no intention of including it!).

    Naturally, the currency for a product is pretty fundamental to how the product price should show.

    The previous developer for this site who wrote the custom plugin has tried to get round this by trusting the client to use specific terms (“eur” and, for some reason, “usa”) in the SKU from which a basic if clause is used to determine the currency symbol.

    The specific issue is with USD products as, understandably, the client is using “usd” in the SKU rather than “usa”.

    Is there something in your plugin which would push the currency into the WooCommerce API? Or would you have an alternative suggestion as to how this could be achieved?

    Cheers
    Greg

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support kenil802

    (@kenil802)

    Hi @descomputers,

    Apologies for the extreme delay on this.

    Regarding the query, here you have shared one link: https://mitmagazine.co.uk/request-mit-magazine/ where we found that there are already different currencies for each product. So, I was just wondering if you are still looking for any help with this or you have already achieved what you wanted to do?

    Also, it will be great if you could mention how you are managing the multiple currencies for these products.

    Regards,
    Kenil Shah

    Thread Starter descomputers

    (@descomputers)

    Hi Kenil

    Thanks for coming back to me on this

    It would be great to find a solution to this.

    Currently the code is a very crude but simple fuction to select the correct currency symbol:

    $symbol = ‘£’;
    if(stripos($product[‘sku’], “eur”) !== false) {
    $symbol = ‘€’;
    } elseif(stripos($product[‘sku’], “usa”) !== false or stripos($product[‘sku’], “usd”) !== false) {
    $symbol = ‘$’;
    }

    Ideally what I would be looking for is a way to get the actual currency code of the product from the WooCommerce product setup and use that to determine the currency symbol.

    If you can help in any way that would be great

    Cheers
    Greg

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Accessing plugin-specific product metadata in Woocommerce API’ is closed to new replies.