I am using a plugin which enables me to set a specific meta data to products. The meta key name is fcrm-settings-woo. I need to apply this meta field with different values to all my products. For example, product with ID 3049 has the meta value
a:1:{s:19:"purchase_apply_tags";a:1:{i:0;s:1:"1";}}
And product with ID 3050 has the meta value
a:1:{s:19:"purchase_apply_tags";a:1:{i:0;s:1:"2";}}
Unfortunately this meta cannot be exported via the native Woocommerce export function. I can see the values though via MySQL. How can I bulk add this meta data to my products? The meta key name is always fcrm-settings-woo, but the values are always different, as shown above. I was told to use
update_post_meta($productId, 'fcrm-settings-woo', $settings);
but I do not understand how to make this work.
source https://stackoverflow.com/questions/70115290/adding-specific-meta-to-woocommerce-products-in-bulk
Comments
Post a Comment