Support » Plugin: Moloni » Error on Generating an Invoice

  • Resolved ricardobaeta


    Hey there,

    I have a website with WooCommerce and the Moloni Plugin activated. It’s all working fine with WooCommerce Orders, and when I go to Moloni inside WordPress I can see all the Orders I have to generate. Up to now, all good. The bad news, is that when I click Generate Order – on any one from those I have – I get an error from Moloni “Erro ao inserir o artigo … Field ‘reference’ must be unique”. When I go to each Product I have, the field inside Moloni block “reference” is different on any given Product.

    When I click on “get more information” this is what I get:

    Endpoint:"ommited by me..."
    Resposta recebida:
        [0] => Array
                [code] => 4 reference
                [description] => Field 'reference' must be unique
    Dados enviados:
        [product_id] => 
        [category_id] => 1719354
        [type] => 1
        [reference] => _Hoo_Jac_-_M,_Bot_Gre_Hoo_Jac_wit_Whi_Hoo_(50_CO_+_50%_POL
        [name] => Hoodie Jacket - M, Bottled Green Hoodie Jacket with White Hook (50% CO + 50% POL)
        [summary] => 
        [ean] => 
        [price] => 47.96748
        [unit_id] => 846019
        [has_stock] => 1
        [stock] => 9
        [at_product_category] => M
        [exemption_reason] => 
        [taxes] => Array
                [0] => Array
                        [tax_id] => 1816352
                        [value] => 23
                        [order] => 1
                        [cumulative] => 0
        [company_id] => "omitted by me..."

    Thank you so much already for your availability on helping me sorting this out.


    • This topic was modified 2 years, 9 months ago by ricardobaeta.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Moloni



    When the product does not exist in Moloni, the plugin will try to create it.
    For that, we need a reference, and since the product in WooCommerce does not have a reference (SKU), we try to create one by using the name.

    What happens is that the reference gets too big, and when trying to create a reference from the product name.

    To solve this, the best solution is to give the product a unique SKU in WooCommerce.

    Why not just use the Poduct ID or the Variation ID when no SKU is available? They are unique, they are even better than the SKU because the SKU can be duplicated by mistake (i can set a SKU like “A123”, then eventually delete that Product/Variation, create another and set the SKU to the same “A123”, this doesnt happen with the Product/Variation ID). Use the SKU if available (that signals that the user makes use of the SKU), use the Product ID for simple products or the Variation ID for variations if the SKU is not available.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error on Generating an Invoice’ is closed to new replies.