Add on not working for WooCommerce field
-
Thanks for the amazing plugin. Like it alot.
I’m experimenting with the add-on; i want to import a value for a custom field.
It’s this field:add_action( 'woocommerce_product_options_pricing', 'wc_cossmo_cost_field' ); function wc_cossmo_cost_field() { woocommerce_wp_text_input( array( 'id' => 'cossmo_cost', 'class' => 'cossmo_cost_input_field', 'label' => __( 'Cossmo Cost', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')' ) ); }
This is my addon; but it’s not working. I tried tens of other possibilities: with $post_id; and so on.
global $woocommerce; $my_addon = new RapidAddon('Cossmo Cost', 'my_first_addon'); $my_addon->add_field('cossmocost', 'Cossmo Cost', 'text'); $my_addon->set_import_function('my_addon_import_function'); function my_addon_import_function($product_id, $data, $import_options) { global $my_addon; update_post_meta($product_id, "_cossmo_cost", $data['cossmocost']); } $my_addon->run();
Can somebody help me out. Any advice is welcome.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add on not working for WooCommerce field’ is closed to new replies.