• Resolved eroliron

    (@eroliron)


    I’m using all import Pro. I have a List and there are variations in this list. I want to import only one of the variations while importing the product. I have a variable “parent_product_id” for variations. When I filter products with XPath, can I filter to take only one of the variations? Or is there any code to do this with the function file? To avoid running queries in vain, my first choice is to filter with XPath.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @eroliron,

    I want to import only one of the variations while importing the product. I have a variable “parent_product_id” for variations. When I filter products with XPath, can I filter to take only one of the variations? Or is there any code to do this with the function file?

    It sounds like this will require custom code, but can you please elaborate on the data a bit? Do all of the parent products in the file have multiple variations and you just want to select 1 variation for each parent product? If so, is that variation the same for every single product or is it different for different parent products?

    Thread Starter eroliron

    (@eroliron)

    Yes, exactly as you said, all variations are like individual products in list, but the variations have an ID.

    I have a affiliate website. It doesn’t matter which of the variation is get. I just want to save one.

    Product A – M parent_id = 0001
    Product A – XL parent_id = 0001
    Product A – XXL parent_id = 0001
    Product A – White parent_id = 0001
    Product A – Black parent_id = 0001

    Product B – XXXL parent_id = 0002
    Product B – Pink parent_id = 0002
    Product B – L parent_id = 0002

    Plugin Author WP All Import

    (@wpallimport)

    Hi @eroliron,

    Thanks for clarifying. I don’t think it’s possible to filter them with XPath, but I see 2 possible ways to achieve what you’re wanting:

    Option 1: For the Unique Identifier on step 4, use the {parent_id[1]} element. This way they extra variations will be detected as duplicates and you’ll only have 1 variation left by the end.

    Option 2: Import the parent ID into a custom field, then use custom code and our API to prevent the duplicates from being imported. See the example snippet at https://www.wpallimport.com/documentation/developers/code-snippets/#only-create-a-post-if-an-existing-post-doesnt-have-the-same-custom-field-value.

    Plugin Author WP All Import

    (@wpallimport)

    Hi @eroliron,

    I’m marking this thread as resolved since it’s been inactive for a while. Please open up a new topic if you still have questions.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Taking only one of the product variations.’ is closed to new replies.