V
V
Viktor Pupkin2019-05-15 13:10:05
WooCommerce
Viktor Pupkin, 2019-05-15 13:10:05

How to add a button in the product card near "add to cart" on woocommerce?

Hello! I have form code

<form action=”https://loans-qa.tcsbank.ru/api/partners/v1/lightweight/create” method=”post”>
<input name=”shopId” value=”test_online” type=”hidden”/>
<input name=”showcaseId” value=”test_online” type=”hidden”/>
<input name=”sum” value=”99000.00” type=”hidden”>
<input name=”itemName_0” value=”НАЗВАНИЕ ТОВАРА” type=”hidden”/>
<input name=”itemQuantity_0” value=”1” type=”hidden”/>
<input name=”itemPrice_0” value=”СТОИМОСТЬ ТОВАРА” type=”hidden”/> 
<input name=”itemCategory_0” value=”КАТЕГОРИЯ” type=”hidden”/> 
<input type=”submit” value=”рассмотреть”/>
</form>

As a matter of fact, you need to insert this case into the product card and at the same time substitute the data of the current product. But I just can’t understand how to extract the data and where exactly then to insert the “view” button so that it would be next to “add to cart”? I really ask for your help. Thank you very much in advance!!!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pychev Anatoly, 2019-05-15
@pton

Here are the product card hooks
The hook is right after the "woocommerce_after_add_to_cart_button" button. Only this hook outputs data to the woocommerce form, so you should not insert your form there. You can simply add the button you need there, and process it in your js script.
In general, the task with the form is not clear. Why don't you do ajax? Why the extra page reload?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question