woocommerce_ajax_get_endpoint
Get WC Ajax Endpoint.
Description
(string) apply_filters( 'woocommerce_ajax_get_endpoint', (unknown) $add_query_arg, (unknown) $request );
Returns (string)
Parameters (2)
- 0. $add_query_arg (unknown) =>
add_query_arg( 'wc-ajax', $request, remove_query_arg( array( 'remove_item', 'add-to-cart', 'added-to-cart' ) ) )
- The add query arg.
- 1. $request (unknown)
- The request.
Usage
- To run the hook, copy the example below.
- $add_query_arg = apply_filters( 'woocommerce_ajax_get_endpoint', $add_query_arg, $request );
- if ( !empty( $add_query_arg ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the woocommerce_ajax_get_endpoint callback
- function filter_woocommerce_ajax_get_endpoint( $add_query_arg, $request ) {
- // make filter magic happen here...
- return $add_query_arg;
- };
- // add the filter
- add_filter( 'woocommerce_ajax_get_endpoint', 'filter_woocommerce_ajax_get_endpoint', 10, 2 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'woocommerce_ajax_get_endpoint', 'filter_woocommerce_ajax_get_endpoint', 10, 2 );
Defined (1)
The filter is defined in the following location(s).
- /includes/class-wc-ajax.php
- return esc_url_raw( apply_filters( 'woocommerce_ajax_get_endpoint', add_query_arg( 'wc-ajax', $request, remove_query_arg( array( 'remove_item', 'add-to-cart', 'added-to-cart' ) ) ), $request ) );