I am looking for information on triggering a button action on another page.
I wrote something like this:
<form id="myForm" action="https://example.com/shop/product/x/" method="post" enctype="multipart/form-data">
<script>
document.getElementsByName("add-to-cart")[0].click()
</script>
<input type="button" onclick="myFunction()" value="Submit form">
</form>
<script>
function myFunction() {
document.getElementById("myForm").submit();
}
</script>
Shop's button:
<button type="submit" name="add-to-cart" value="146335" class="single_add_to_cart_button button alt">Add to cart</button>
I need a script that, after transferring to the store's website, will add the product to the cart for the customer. Can someone bring me closer to the solution?