Skip to content

What is the purpose of the action 'pmxi_update_product_variation' ? #72

@gnanet

Description

@gnanet

Sorry for the long intro, but it explains how I came across the action pmxi_update_product_variation.

After a well planned data preparation of a webshop import, i was able to generate a well structured XML from an excel file for a client of mine.

I splitted the XML into simple products, variable products, and on a second occassion, i generated an XML for additional variations for existing variable products.

For the imports of variable products i used the so called option_5. To differentiate between a full-fledged import of variable products, and the add only variations, i simply added an extra XML element called import_type to indicate create/update.

The solution for adding new variations was a big ordeal for me, because of my lack of experience in php programming, but i didnt want to move away from the "product->variations->variation" XML structure i created, so i wrote an import post-processor function, that relies on pmxi_saved_post filter. The function uses a custom field called _import_parent_sku to find which (already existing) variable-product will take the children of the actual imported product, and merge the attributes into the pre-existing product, and sets misc meta-s that were necessary in my case. After the child products are merged, the function leaves an "empty" product, that can be safely removed.

For long term, i was not happy with this solution because the extra mile to import an extra batch of variable products, for merging only, could introduce problems, i may not be prepared for. So i was motivated to try the I'm importing new variations to existing products option.
On the third loop of trying i noticed, that the option add_variation_to_existing_product is disabling the field <==> xml label mapping. Without the attribute mapping the import will either fail, or seemingly succeed, without any results. I started to read myself through the code to find out what and why happens, and if possible, to find a solution for my problem.

Actually i think, without the variation attribute mapping, the option_6 is not really useful choice for the parent-child structured XML import format.

The question remains, what is the purpose of pmxi_update_product_variation action, and whis is it missing from the folder wpai-woocommerce-add-on/actions ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions