Ecommerce Shopify WordPress Discussion

How can I call woocommerce action inside callback of custom ajax action in wordpress?

I'm trying to customize the default checkout form of woocommerce in my WordPress website. I have created on custom button and added an ajax call to the button to fetch some data from third party service using API call. Now, what I'm trying to achieve is based on the API response I need to create some custom checkout fields and when I'm adding an woocommerce_checkout_fields hook inside an callback of ajax it's not working. It seems like this is not the correct approach to trigger woocommerce hooks with ajax call. Can anyone suggest how can I call woocommerce hooks inside the callback function of ajax or is there any approach to make it work? P.S: I tried to hide/unhide the fields using JQuery because the created custom fields are required and only hiding fields using JQuery is handling client side validation so it's throwing an error on form submission. Any help is Appreciated!
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.