Thread Starter
Alex
(@jandru)
Hi again,
We found a workaround using the transformation option. How? Doing a multiplication with the value of order ID. The transformation example could be [{order_id}*10] and not will match with the existent post ID.
This works fine with the initial import, but, if you create new content (a page, post, image, etc…) this will create a new row in the posts table with the next ID available, and if you want to import again for add new orders, this will crash by Order(id) conflicts.
So, is there any way to set the field (or combination) for set unique key if order_id is not selected?
Thank you so much
Hi @jandru,
Thank you for reaching out to us.
Currently, the order_id serves as the unique identifier during import. However, we can check the possibility of setting other fields as unique identifiers using a code snippet.
We will keep you updated with the progress.
Hi @jandru,
Thank you for waiting.
We have developed a code snippet to use the order key as a unique identifier. You may copy and paste this code snippet into your active theme’s function.php file, or use any other plugin to achieve this.
Thread Starter
Alex
(@jandru)
Hi!
Firstly, thank you so much for the code snippet. Looks great! We’ll try it in the next few days and tell you something about it
Again, thank you so much!
Thread Starter
Alex
(@jandru)
Hi again,
We tried the code snippet and it worked super fine!
Also, following the plugin code for understand a little more the snippet or hook, we believe that there is a typo in the script:
admin/modules/order/import/import.php
More exactly in the line 698:
if('shope_order_placehold' !== $post_table_type && $order_table_type !== $this->post_type){
Shouldn’t it be shop_order_placehold
?
Thank you so much!!