WordPress copy price from parent product

We have the following WordPress tables:

wp_posts: ID, post_type, post_parent
wp_postmeta: meta_id, post_id, _role_based_price

During a product import with WP All Import, a function is triggered after each product successfully updated/created. We know the ID of this product.

With a MySQL query the function should check if the updated ID is a product or a product variation (post_type). If it is a product variation, is should copy the _role_based_price from its post_parent, and insert a row in wp_postmeta (or update existing) with it’s own post_id.

Any help with this query is greatly appreciated. We cannot figure this one out.

Thank you!

Read more here: WordPress copy price from parent product

Leave a Reply

Your email address will not be published. Required fields are marked *