• Resolved gherry.gecko

    (@gherrygecko)


    Hi team,

    We have a client who is using this plugin. From what I understand how the plugin works is that it internally creates a new product but with the localized description, name, etc.

    From what I test out when I fetch all the products through WoocommerceAPI, these localized products are not in the response. However when I fetch a specific order and somehow that order is created in site with different language, then when we fetch the order through API, the line item actually lists the product id of the localized product and not the original product.

    As you may understand, for those who are using Woocommerce API, this can cause lots of confusion since original product and localized product are not separate products, so this can cause double accounting for matters such as inventory.

    Any plan to fix this?

    Regards,
    Gherry

    PS: We are using version 3.6.11 and WC version 2.4.7

    https://wordpress.org/plugins/woocommerce-multilingual/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Can you please provide more details about this issue?
    Which functions of the API do you use?
    How can I reproduce this?
    Have you tested latest version if the same behaviour is observer there?

    In general – products are created different per language, while orders are not. The order language is controlled via custom field that determines the language, and I think it is normal that you get the product based on what language is supplied for the order.

    Thread Starter gherry.gecko

    (@gherrygecko)

    Hi George,

    I can’t give you any test server or data to play with because this happened in one of our client store and I’m not sure if they are comfortable with sharing that details.

    However, to replicate this you can test it out by creating a product and its translation. Say the original product will get id 1 and the localized product will get id 2. When you create an order in that localized version with that product and you hit the Order Endpoint with GET request (https://woothemes.github.io/woocommerce-rest-api-docs/#view-an-order), then you’ll get product id 2 in the line items.

    This is troublesome because product 1 and product 2 are actually the same product. Imagine if you’re tracking the sold stock of that product by getting all the orders through API, you would like to get the sold stock of product 1 which is the original product and not fragmented by its localized product.

    I will attempt to test this.
    However please be aware that the products synchronize all details between one-another – like stock qty, prices and similar – they are always the same for both products, so essentially the api would get the correct information, despite the other product being queried.

    I have investigated this, and indeed it returns the product in the second language, but I don’t understand why this is a problem. The two products are synced together. Please provide more details in order for me to understand why this is a problem.

    Thread Starter gherry.gecko

    (@gherrygecko)

    Hi George,

    Add-ons should not leak its internal implementation to the API. As an external consumer of the API, I should just assume that a product id represents a unique product. The product id and the localized product id represent the same unique product in real world and not a different one.

    For example, product A has id 1 and the localized version of product A has id 2. If there’s an order and it lists product id 2 in the line items, then how should I know that I need to update the stock of the product A? In real world, product id 1 and product id 2 are the same product and they have the same stock.

    Do you have any plan on fixing this?

    Cheers,
    Gherry

    I will ask our developers about this issue, and I will get back to you when I have some response.

    Thread Starter gherry.gecko

    (@gherrygecko)

    Hi George,

    Any updates on this?

    I have brought your case to our developers, and they responded the same.
    The real problem is that we do not translate the orders – that is why when visiting an order the product there is the one in the specific language.
    If you update the stock of the localized product, then the original should update as well, so there should be not an issue because of that.
    You question is still under consideration of our developers, and I have no other information.

    Hi George,

    This is an issue for me too. Do you have any updates, yet?

    Well, this is not actually an issue – since it this is the intended way of how WCML works, but I have escalated this a while ago, and for now the implementation of this feature is postponed for a future version.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Order API line items returns translated product id’ is closed to new replies.