In frontend add-product form, when I try to insert a product, the form sends all the data correctly except the Woocommerce price. Although this field is filled in, it is not saved in the db. Why?
The page is: hidden link
The reason the price isn't updated is that the field you added to your product form isn't the actual WC price field, it is a special field registered by Toolset for internal purposes, and so your form has set the value for that field rather than the actual price field.
The reason the actual price field isn't available is because it is a hidden custom field (WC registers the price field with a key of _price; the underscore means it is a hidden rather than public custom field).
You can include this is in your form, but it will involve switching to Expert mode for it to work. Once you switch to expert mode you can't switch back without losing changes, so just to be on the safe side, you might want to duplicate your original form and work on the copy for testing.
Before switching to Expert Mode, from the right hand side drag a numeric generic field into your form where you want it to be shown.
Set the field slug to be "_price", and label the field (e.g. "Price").
There is an additional setting required for this field for it to be saved (normally generic fields are discarded after submission), but it can only be added in Expert mode, so switch mode now.
Locate the markup where this field is inserted and edit it to add a setting "persist":1 like so:
Thak you, Nigel, it's perfect, but I have a new question about this.
Is it possible to keep the data entered in the form in an email addressed to the administrator? This would make it easier not to lose user data
Sorry, but when I create a form to add a product via the frontend I am faced with two problems that I still can't solve.
The first problem relates to the email to the administration and shows the summary data of the form.
I used this shortcode, suggested by you
[wpv-post-field name = "_ price"]
to fill in the email fields, as you can see in attached image (_INPUT). But the email only shows the price (_OUTPUT), while all the other fields are empty. In the dashboard, however, the data is entered correctly, apart from the attributes.
And this is the second problem. Why are attributes not stored?
The wpv-post-field shortcode is only intended to output raw values of non-Types custom fields. For anything else, you should use the Fields and Views button to insert the shortcode for the field you require. (For standard fields that will insert dedicated shortcodes such as wpv-post-title, for custom fields it will insert a types shortcode.)
As this is marked as resolved, if you have further problems, could you please open a new thread?