Order Button
No ajax calls are sent when clicking the order button.
Instead, the order button is wrapped in a <form> element that physically submits the page.
The reason for this is that the server might need to redirect the user to a third-party payment gateway.
There is no need to pass additional form data with the request.
User input from other UI components should already be stored server-side.
Example
Initialize using JavaScript.
The formAttributes option can contain any form attributes.
import { OrderButtonUI } from 'geta-checkout';
render('[data-order-button]', OrderButtonUI, {
formAttributes: {
action: 'checkout/order', // Example
method: 'post' // Example
}
});
As with other UI components, you can also pass options through a data-attribute.
<div data-order-button='{"formAttributes": {"action": "checkout/order", "method": "post"}}'></div>
Writing your own
If the built-in component doesn't fit your needs, you can easily create your own:
<form action="checkout/order" method="post">
<button>
Order
</button>
</form>