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
- AJAX form post returns 0
- Update Data parameter of a wp_localize_script() call
- UWooCommerce – add cart discount programmatically?
- jquery & ajax sending data to php
- wp_localize_script is not adding a global variable for javascript
- Can’t get AJAX call working in custom plugin
- Bad Request in AJAX
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- 400 Bad Request, in wordpress theme development, wp_ajax
- Ajax is not working in a loop
- Remove an action by extending class and replacing it
- Woocommerce order empty items array
- ajax recursive calls on wordpress returning answers outsite the function scope
- Ajax submit result opens in admin-ajax.php
- Are there any security risks when submitting data-attribute data through AJAX?
- How to get all product in the woo-commerce? [closed]
- insert query on a custom table using ajax with jQuery plugin Jeditable
- How to get error object returned by wp_create_user
- Plugin AJAX Save to Custom Table
- Woocommerce inventory [closed]
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- Data not insert and update through ajax and jQuery in admin page?
- How to change WooCommerce loop product title HTML output in single product page and archive page
- Can woocommerse be used dynamically for billing from another plugin for payment processing?
- Sending an SMS on new order placed – WooCommerce
- Setting a JSON web token from a secondary api as a secure cookie on WordPress
- WP ajax requests not stacking?
- Can we use a library under MIT license in a WooCommerce plugin?
- Set _regular_price 0 if empty in woocommerce product
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
- WooCommerce Endpoints content
- How remove trashed WooCommerce orders from wc_get_orders() result?
- How to call code when adding WooCommerce menu items via woocommerce_account_menu_items
- Duplicate shipping method logic to another shipping method [closed]
- AJAX button with success callback. (Titan Framework)
- ajax working when function is on child theme but not in plugin page
- AJAX call to admin-ajax.php by subscriber returns home page
- Custom Plugin Options Won’t Update
- Hide one specific woocoomerce product
- Woocommerce – Provide Associated Category Link for Product List Plugin [closed]
- AJAX call returns ‘testtest0’ instead of ‘test’ – why?
- get_shipping_methods() return empty rate
- Ajax function is not working on WordPress
- About a programming language starts with [closed]
- Best practice for plugin: always detect admin-ajax call?
- add_action wp_ajax_ not loading in plugin file WP Network
- Why is the form not updating when I select a new sector from the list?
- Workflow for new importer plugin – your advices?
- Plugin Form Submitting to admin-ajax.php instead of admin-post.php
- Ajax +wordpress onClick link redirect to new page and create html content
- AJAX request not routing through proxy
- Get cat parameter from admin-ajax
- Remove Products From Category
- want to show CMB2 metabox on woocommerce product data tab
- wp_schedule_single_event is set correctly but sometimes not fired
- Dynamic page generation upon purchase of a product
- Customise Grouped Product display in Woocommerce with custom column
- WordPress (pagenow link) in ajaxurl change after i change plugin language
- 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)?
- Ajax on the Administration Side of plugin – returns 0
- Create Woocommerce product without creating api credentials
- wp_query ‘s’ parameter does not work with WC_AJAX
- How to do admin ajax request in a plugin for rest api
- Pass Values in URL on WooCommerce Product Page
- Ajax action has 200 status but response of No response data available for this request
- Woocommerce place order update shipping price
- Jquery php request is returning a weird result
- WordPress Does not grab the string sends useing AJAX response, wp_ajax hook
- Add custom product data using javascript when add to cart button is clicked
- Posts form with AJAX request – Plugin development
- 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?
- Bad request 400 using class based files
- Forbidden Error in ajax call with wordpress
- Securing custom rest API endpoints with public access from PWA
- How do I add filter with woocommerce categories?
- ajax stopped working when not logged in wordpress
- WooCommerce – Stop assigning order numbers
- ajax call return 406 not acceptable for non logged users only
- Does $this context change in an AJAX callback?
- Adding customs fields on each product on the cart
- Override woocommerce loop-start.php from theme using plugin?
- Getting products information, in woocommerce based on products ID
- How to direct WordPress to load custom template for custom post type
- ajax response strips multidimensional array and unable to decode
- PHPUnit Testing and woocommerce Constant
- Redirect WooCommerce checkout to cart
- 400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true
- Rate limiting ajax requests in WordPress