Wordpress - Hook on submit form - php

On a page managed by each customer of my Wordpress website, I have a form with multiple fields, not only Wordpress core fields, but also WooCommerce fields, JetEngine fields, etc.
I need to update the user data on another app, via API. I can't find a hook where I can plug my own function, hook fired when all other hook are processed. Because if I hook profile_update, for example, the updated_user_meta calls have not been made, and all the data are not updated yet.
So my thought led me to find a hook which is fired when the form is submit. This way I will be able to get the form fields in my function (called with add_action) and then launch my API calls.
The problem is I can't find a hook which is fired on form submit. Do you have any idea of how I can manage that?
Thanks for your help!
PS: this question is not helping, because it's about admin form, and I'm not on admin side but on customer side, on his profile form.

Related

How can I place an order using AJAX in Woocommerce?

I am using Woocommerce on a locally hosted WordPress.
I would like the 'Place order' button in the order review section/checkout section of Woocommerce to process the order using AJAX (so that the order details are added to the database without refreshing the page).
I can't seem to find any information on this anywhere. Thanks
You'll have to add an eventlistener to the "Place order" button's click event, and prevent the default behaviour. Then use Ajax to make a POST request to the WooCommemerce REST API's order endpoint. The documentation contains all the information needed to set it up, and examples of such requests.
You can use the response to update your page with relevant information.

Paypal with Contact Form 7

I have a problem contact form 7. I want payment with paypal combined contact form 7 . Picture :
Any suggestion for me?
Thanks.
There are several ways to solve this. You can either (a) redirect your submitted form to the paypal page on successful submission , or you could look at (b) building a paypal button on the fly when the form is being filled.
To implement solution (a) I would recommend your map your form to a custom using the Post My CF7 Form plugin. The plugin allows you to either hook into the submission process once the post is saved and integrate the paypal payment page (from PHP) using the saved fields, or you can also redirect to a confirmation page on your site with the amount to be paid and a paypal button. The advantage of saving your submission to a custom post means you can also save the paypal payment confirmation in the same post and keep a track of your payments.
For solution (b), just bind a 'change' event on your fields that affect the payment and build the paypal button url accordingly, see this answer as an example.
PS: If you wish to create a responsive grid-layout as shown in your screenshot, I would recommend the Smart Grid plugin extention to achieve a responsive grid layout that you have on your screenshot.

WooCommerce: Run filter inside action hook

I'm working on a payment gateway plugin for WooCommerce and I need to edit the checkout form. When the user has selected 'Sweden' as their country, and they selected 'Klarna' as their payment method, an extra input field should appear for the user's social security number (this is totally normal in Sweden, really).
As far as I understand, the woocommerce_checkout_update_order_review action gets triggered when something changes in the checkout form. I believe I can use the woocommerce_get_country_locale filter to add the social security number field for Swedish customers. So, inside my woocommerce_checkout_update_order_review hook, I want to trigger the woocommerce_get_country_locale filter. How is this done?
Thanks in advance.

Use woocommerce with calculated quot from front end

I'm developing a website for a courier service, that has service quotation filling at the front end.
I did all form things working, a quotation will output variable with the cost of service in PHP.
After filling the form there will be checkout button, with that checkout button i need to save the details of the user, and that price to the woo commerce page to check-out/or fill further details. I searched throughout the google and got 1 solution to create a product with these values in front end. But its became very difficult to figuring out signing in, saving values, keep details in specific formate etc... for me as a beginner in PHP.
Can anyone help me with this?.
i just need woo commerce to make checkout with user entered details in the form.... .
EDIT & Updated :
Thanks for reply LoicTheAztec, I have gone through quick toure now
About code : I'm sending the values calculated in form to the page called buy-now using URL using javascript window.location.href=.
like http://example.com/buy-now?price=120&weight=80&location=000001
And also I'm able to fetch the value using
if (isset($wp_query->query_vars['pricef'])) in page template. (with StackOverflow help) and I'm checking user is logged in? using if(!is_user_logged_in()) and showing login form, After login also i can get the variables.
Now I need to create a transaction using this.
Saving data like a product or post and proceed for payment, I don't need to use woocommerce to do this but need some sort of idea to make it work.
Thank you.

Magento observer event when user has submitted their billing details

I am trying to find a Magento frontend observer event that will trigger on the 'onepage checkout' page when the user has entered their 'Billing' details and clicked the submit button.
I am using Magento 1.7 and have come across this site which has a list of events, however I am unsure which this would be?
http://www.nicksays.co.uk/magento-events-cheat-sheet-1-7/
Can anyone suggest anything or point me in the right direction?
The data from the billing address is sent to Mage_Checkout_OnepageController::saveBillingAction so you can use controller_action_predispatch_checkout_onepage_savebilling
Then you can access in your observer the data sent through post like this
$post = Mage::app()->getRequest()->getPost();
But this may not fit your needs. If it doesn't then please explain what you want to do ehn you captrure the data.
The following worked observer worked:
checkout_controller_onepage_save_shipping_method

Categories