Answer the question
In order to leave comments, you need to log in
How to send what is in the cart with the order form?
Good afternoon!
There is such a task
The store is made on wordpress using the WooCommerce plugin, a form generated by the Contact Forms 7 plugin is used to send data
.
With my spinal cord, I understand what needs to be done
1. Get the data from the basket: pull it out with javascript from <tr class="cart_table_item">
2. save it to a variable
3. send it along with other data via the contact form
Tell me step by step how to solve this problem.
Answer the question
In order to leave comments, you need to log in
Probably nothing without editing the Contact Forms 7 plugin.
Rip out the product link (although the product ID is better), create a hidden field with this ID, then tweak the plugin so that it sends this field.
The second, more tricky way: I don’t remember if there are hidden fields in the constructor in Contact Forms 7, if so, then create a hidden field with an id, then use the script to rip out the record ID of the product (s), and insert it into the hidden field (with several products insert separated by commas). Next, you need to look for a filter in Contact Forms 7, using which you can replace these record IDs with links. For example, you can try these: "wpcf7_mail_components", "wpcf7_display_message", or even look for a suitable one. In general, you need to find the data processing filter before sending and replace the desired code
The cart data is stored in the session or in cookies. You can read them on the server and you do not need to transfer them from the client.
Unfortunately, I'm not familiar with current plugins, but maybe you can explicitly set the form for the fields?
htmlbook.ru/html/input/form
Then all the data will go with the desired form.
For the first point
<script type="text/javascript">
jQuery(document).ready(function($){
var getvalue1 = $('td.product-name').text();
var getvalue2 = $('td.product-price').text();
})
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question