You need to setup the change event on the field:
$('select.shipping-field').on('change', function()) {
$.post(
ajaxurl,
{
action: 'shipping_special',
data: 'your data here..'
},
function(response){
// The response should contain your special field HTML
}
);
});
You can pass the current shipping select option
Then your theme’s functions.php
file needs to have the action to return your special field, if the shipping is zasilkovna
add_action('wp_ajax_shipping_special', 'shipping_special_field' );
add_action('wp_ajax_nopriv_shipping_special', 'shipping_special_field' );
function shipping_special_field() {
// Return your special field HTML here
}
See wp_ajax__requestaction, this tutorial from WPMUDev or this SO answer;
Related Posts:
- get all products of one category
- Woocommerce checkout update totals with datepicker
- Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin
- “add to cart” links css class “ajax_add_to_cart” doesn’t show in woocommerce in widget sidebar
- Trigger a JavaScript function based on the data fetched from Woo commerce hook
- Return custom product in ajax call loop
- Nonces can be reused multiple times? Bug / Security issue?
- How-to implement admin Ajax inside an admin WP_List_Table?
- Using AJAX in FrontEnd with WordPress Plugin Boilerplate (wppb.io)
- WooCommerce get Shipping Class of product from either the product id or the order after order is completed
- How to iterate through custom posts and add the title to an array
- Adding callback function for wp_ajax_ has no effect
- Plugin Settings not Saving on Ajax re-ordered table
- Admin-ajax.php appending a status code to ajax response
- set_sale_price in WooCommerce [closed]
- How to update total price of completed order in woocommerce? [closed]
- Ensure function has completed before allowing another Ajax call
- How do I change the initial quantity of a product in woocommerce?
- Order properties should not be accessed directly
- Fetching the value of forms in WordPress AJAX
- include wp-blog-header not working on MAMP
- Any problem in using native jquery ajax style instead of using admin-ajax.php?
- .mo translation strings not loading in PHP scripts that handle AJAX calls
- How can I pass get_the_author_meta(‘user_email’) through the REST API?
- WooCommerce Admin Reports : Get custom product report based on date range
- get post attachment using ajax
- Create a new post using rest api and save featured image using an external image url
- Woocommerce – Convert Delivery method into a custom field
- how to search users by ajax live search
- Show disclaimer with accept button before redirecting to the payment gateway website
- How do I apply a custom discount to individual product total prices depending on their categories on the cart and checkout pages of WooCommerce? [closed]
- Can’t get woocommerce_get_price_html to work [closed]
- wp.template() returns tags in Ajax response
- How to restrict access to image folder depending on whether product is purchased or not?
- woocommerce_checkout_order_processed hook executing function twice
- Fatal error: Uncaught Error: Call to undefined function get_option()
- Is there a way in which I can compare product id with the order id to display content on front end before placing the order? [closed]
- Woocommerce Composite Products – Add a composite product to cart programmatically via ajax [closed]
- template_redirect or admin-ajax.php?
- how to get context information inside my funcion
- Change WooCommerce Email Header using custom plugin
- AJAX form post returns 0
- UWooCommerce – add cart discount programmatically?
- Bad Request in AJAX
- Remove an action by extending class and replacing it
- Ajax submit result opens in admin-ajax.php
- insert query on a custom table using ajax with jQuery plugin Jeditable
- Plugin AJAX Save to Custom Table
- Woocommerce inventory [closed]
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- How to change WooCommerce loop product title HTML output in single product page and archive page
- Setting a JSON web token from a secondary api as a secure cookie on WordPress
- WooCommerce Endpoints content
- How remove trashed WooCommerce orders from wc_get_orders() result?
- Duplicate shipping method logic to another shipping method [closed]
- Hide one specific woocoomerce product
- get_shipping_methods() return empty rate
- Best practice for plugin: always detect admin-ajax call?
- Why is the form not updating when I select a new sector from the list?
- Plugin Form Submitting to admin-ajax.php instead of admin-post.php
- AJAX request not routing through proxy
- Get cat parameter from admin-ajax
- wp_schedule_single_event is set correctly but sometimes not fired
- Change reminder email date to 14 days before
- Make a php array load faster
- How to make every image title equal to alt text(wordpress/woocommerce)?
- Pass Values in URL on WooCommerce Product Page
- Woocommerce place order update shipping price
- product-attribute-slug-is-too-long-28-characters-max
- GET request return value as error instead of success
- How to control ajax calls without effecting memory of server?
- Forbidden Error in ajax call with wordpress
- How do I add filter with woocommerce categories?
- ajax stopped working when not logged in wordpress
- ajax call return 406 not acceptable for non logged users only
- Does $this context change in an AJAX callback?
- Getting products information, in woocommerce based on products ID
- ajax response strips multidimensional array and unable to decode
- PHPUnit Testing and woocommerce Constant
- WordPress Ajax not returning Response
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- Woocommerce Product finder feature on home page
- want to confirm popup with “Yes” and “No” button when user click on add to cart
- Woocommerce Single Product Tabs Got Duplicate
- Woocommerce product not appearing in category list page when created programatically [closed]
- Inserted data from database does not showing on front-page without referesh page?
- wp_ajax function return the html page
- $_SESSION inside php function executed by AJAX
- Two same AJAX calls – one is working, other doesn’t
- WordPress Reset password Strength set to medium
- How To do Ajax In WordPress Custom Plugin?
- external Integration with wordpress timeout error
- WP Ajax on page load not working on bluehost but was working on Godaddy
- Ajax not working to insert, query and result data
- WP: adding Javascript to specific woo commerce pages
- Can’t get query string in ajax call
- Ajax url value to pass ‘variable’ to use in query
- An adiitional function fires on my AJAX submit
- How to only Load scripts on variable products page
- how do I find out if a placed order was deleted or trashed? [closed]