Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

How do I clone a WooCommerce field to an other location?

$
0
0

Replies: 0

What is the procedure when you want to add a Woocommerce field into a plugin page where it’s not inserted by Woocommerce by default?

I have hidden the field at its original location with CSS, and I need it at an other place, on a form generated by a plugin, and I need to submit data with it.

The POST procedure is already coded in the page because there are other fields to submit (with the same submit button) in that form, so all fields will be submitted at once.

I have 2 action hooks provided by the plugin that generates the form with the other fields where I want to insert the Woocommerce field, one for showing custom fields, and an other for storing custom fields.

So now I have (priorities omitted):

add_action('action_name', 'my_function_name')
function my_function_name() {

    // woocommerce field
}

I have some questions:

– Do I need any parameters/args? .There are 2 defined at the do action, but I don’t think I need them if I want to output an existing Woocommerce field.

– How do I output the field?

I have given a custom title to my Woocommerce field, but when I cd into my public_html and execute “grep -r ‘my field title'”, it doesn’t find anyhting.

Because I wanted to find the PHP code that outputted the field on the place where I have hidden it with CSS, that’s why I searched for the field title with grep, I usually find the PHP that outputs the fields like that, in some files.

What is the easiest way to output (and store) an existing WooCommerce field in an add action function?

Do I need the function at all or there is a way to embed WC fields in the do action declaration without a function?

How do I find the PHP that generates the field if grep won’t find anything?

If there are no priorities defined at the do action, how do I find the right priorities?

Thanks in advance!
Happy Holidays!

  • This topic was modified 38 minutes ago by berry metal.

Viewing all articles
Browse latest Browse all 59525

Trending Articles