PHP Class WC_AJAX

AJAX Event Handler
Author: WooThemes
Mostra file Open project: woocommerce/woocommerce Class Usage Examples

Public Methods

Method Description
add_ajax_events ( ) Hook in methods - uses WordPress ajax handlers (admin-ajax).
add_attribute ( ) Add an attribute row.
add_new_attribute ( ) Add a new attribute via ajax function.
add_order_fee ( ) Add order fee via ajax.
add_order_item ( ) Add order item via ajax.
add_order_note ( ) Add order note via ajax.
add_order_shipping ( ) Add order shipping cost via ajax.
add_order_tax ( ) Add order tax column via ajax.
add_to_cart ( ) AJAX add to cart.
add_variation ( ) Add variation via ajax function.
apply_coupon ( ) AJAX apply coupon on checkout page.
bulk_edit_variations ( ) Bulk edit variations via AJAX.
calc_line_taxes ( ) Calc line tax.
checkout ( ) Process ajax checkout form.
define_ajax ( ) Set WC AJAX constant and headers.
delete_order_note ( ) Delete order note via ajax.
delete_refund ( ) Delete a refund.
do_wc_ajax ( ) Check for WC Ajax request and fire action.
feature_product ( ) Toggle Featured status of a product from admin.
get_cart_totals ( ) AJAX receive updated cart_totals div.
get_customer_details ( ) Get customer details via ajax.
get_customer_location ( ) Locate user via AJAX.
get_endpoint ( string $request = '' ) : string Get WC Ajax Endpoint.
get_refreshed_fragments ( ) Get a refreshed cart fragment, including the mini cart HTML.
get_variation ( ) Get a matching variation based on posted attributes.
grant_access_to_download ( ) Grant download permissions via ajax function.
increase_order_item_stock ( ) Increase order item stock.
init ( ) Hook in ajax handlers.
json_search_customers ( ) Search for customers and return json.
json_search_downloadable_products_and_variations ( ) Search for downloadable product variations and return json.
json_search_products ( string $term = '', boolean $include_variations = false ) Search for products and echo json.
json_search_products_and_variations ( ) Search for product variations and return json.
link_all_variations ( ) Link all variations via ajax function.
load_order_items ( ) Load order items via ajax.
load_variations ( ) Load variations via AJAX.
mark_order_status ( ) Mark an order with a status.
product_ordering ( ) Ajax request handling for product ordering.
rated ( ) Triggered when clicking the rating footer.
reduce_order_item_stock ( ) Reduce order item stock.
refund_line_items ( ) Handle a refund via the edit order screen.
remove_coupon ( ) AJAX remove coupon on cart and checkout page.
remove_order_item ( ) Remove an order item.
remove_order_tax ( ) Remove an order tax.
remove_variations ( ) Delete variations via ajax function.
revoke_access_to_download ( ) Delete download permissions via ajax function.
save_attributes ( ) Save attributes via ajax.
save_order_items ( ) Save order items via ajax.
save_variations ( ) Save variations via AJAX.
shipping_classes_save_changes ( ) Handle submissions from assets/js/wc-shipping-classes.js Backbone model.
shipping_zone_add_method ( ) Handle submissions from assets/js/wc-shipping-zone-methods.js Backbone model.
shipping_zone_methods_save_changes ( ) Handle submissions from assets/js/wc-shipping-zone-methods.js Backbone model.
shipping_zone_methods_save_settings ( ) Save method settings
shipping_zones_save_changes ( ) Handle submissions from assets/js/wc-shipping-zones.js Backbone model.
tax_rates_save_changes ( ) Handle submissions from assets/js/settings-views-html-settings-tax.js Backbone model.
term_ordering ( ) Ajax request handling for categories ordering.
update_api_key ( ) Create/Update API key.
update_order_review ( ) AJAX update order review on checkout.
update_shipping_method ( ) AJAX update shipping method on cart page.

Private Methods

Method Description
update_order_review_expired ( ) Session has expired.
variation_bulk_action_delete_all ( array $variations, array $data ) Bulk action - Delete all.
variation_bulk_action_toggle_downloadable ( array $variations, array $data ) Bulk action - Toggle Downloadable Checkbox.
variation_bulk_action_toggle_enabled ( array $variations, array $data ) Bulk action - Toggle Enabled.
variation_bulk_action_toggle_manage_stock ( array $variations, array $data ) Bulk action - Toggle Manage Stock Checkbox.
variation_bulk_action_toggle_virtual ( array $variations, array $data ) Bulk action - Toggle Virtual Checkbox.
variation_bulk_action_variable_download_expiry ( array $variations, array $data ) Bulk action - Set Download Expiry.
variation_bulk_action_variable_download_limit ( array $variations, array $data ) Bulk action - Set Download Limit.
variation_bulk_action_variable_height ( array $variations, array $data ) Bulk action - Set Height.
variation_bulk_action_variable_length ( array $variations, array $data ) Bulk action - Set Length.
variation_bulk_action_variable_regular_price ( array $variations, array $data ) Bulk action - Set Regular Prices.
variation_bulk_action_variable_regular_price_decrease ( array $variations, array $data ) Bulk action - Decrease Regular Prices.
variation_bulk_action_variable_regular_price_increase ( array $variations, array $data ) Bulk action - Increase Regular Prices.
variation_bulk_action_variable_sale_price ( array $variations, array $data ) Bulk action - Set Sale Prices.
variation_bulk_action_variable_sale_price_decrease ( array $variations, array $data ) Bulk action - Decrease Sale Prices.
variation_bulk_action_variable_sale_price_increase ( array $variations, array $data ) Bulk action - Increase Sale Prices.
variation_bulk_action_variable_sale_schedule ( array $variations, array $data ) Bulk action - Sale Schedule.
variation_bulk_action_variable_stock ( array $variations, array $data ) Bulk action - Set Stock.
variation_bulk_action_variable_weight ( array $variations, array $data ) Bulk action - Set Weight.
variation_bulk_action_variable_width ( array $variations, array $data ) Bulk action - Set Width.
variation_bulk_adjust_price ( array $variations, string $field, string $operator, string $value ) Bulk action - Set Price.
variation_bulk_set ( array $variations, string $field, string $value ) Bulk set convenience function.
variation_bulk_toggle ( array $variations, string $field ) Bulk toggle convenience function.
wc_ajax_headers ( ) Send headers for WC Ajax Requests.

Method Details

add_ajax_events() public static method

Hook in methods - uses WordPress ajax handlers (admin-ajax).
public static add_ajax_events ( )

add_attribute() public static method

Add an attribute row.
public static add_attribute ( )

add_new_attribute() public static method

Add a new attribute via ajax function.
public static add_new_attribute ( )

add_order_fee() public static method

Add order fee via ajax.
public static add_order_fee ( )

add_order_item() public static method

Add order item via ajax.
public static add_order_item ( )

add_order_note() public static method

Add order note via ajax.
public static add_order_note ( )

add_order_shipping() public static method

Add order shipping cost via ajax.
public static add_order_shipping ( )

add_order_tax() public static method

Add order tax column via ajax.
public static add_order_tax ( )

add_to_cart() public static method

AJAX add to cart.
public static add_to_cart ( )

add_variation() public static method

Add variation via ajax function.
public static add_variation ( )

apply_coupon() public static method

AJAX apply coupon on checkout page.
public static apply_coupon ( )

bulk_edit_variations() public static method

Bulk edit variations via AJAX.
public static bulk_edit_variations ( )

calc_line_taxes() public static method

Calc line tax.
public static calc_line_taxes ( )

checkout() public static method

Process ajax checkout form.
public static checkout ( )

define_ajax() public static method

Set WC AJAX constant and headers.
public static define_ajax ( )

delete_order_note() public static method

Delete order note via ajax.
public static delete_order_note ( )

delete_refund() public static method

Delete a refund.
public static delete_refund ( )

do_wc_ajax() public static method

Check for WC Ajax request and fire action.
public static do_wc_ajax ( )

feature_product() public static method

Toggle Featured status of a product from admin.
public static feature_product ( )

get_cart_totals() public static method

AJAX receive updated cart_totals div.
public static get_cart_totals ( )

get_customer_details() public static method

Get customer details via ajax.
public static get_customer_details ( )

get_customer_location() public static method

Locate user via AJAX.
public static get_customer_location ( )

get_endpoint() public static method

Get WC Ajax Endpoint.
public static get_endpoint ( string $request = '' ) : string
$request string Optional
return string

get_refreshed_fragments() public static method

Get a refreshed cart fragment, including the mini cart HTML.
public static get_refreshed_fragments ( )

get_variation() public static method

Get a matching variation based on posted attributes.
public static get_variation ( )

grant_access_to_download() public static method

Grant download permissions via ajax function.
public static grant_access_to_download ( )

increase_order_item_stock() public static method

Increase order item stock.
public static increase_order_item_stock ( )

init() public static method

Hook in ajax handlers.
public static init ( )

json_search_customers() public static method

Search for customers and return json.
public static json_search_customers ( )

json_search_downloadable_products_and_variations() public static method

Search for downloadable product variations and return json.
See also: WC_AJAX::json_search_products()

json_search_products() public static method

Search for products and echo json.
public static json_search_products ( string $term = '', boolean $include_variations = false )
$term string (default: '')
$include_variations boolean in search or not

json_search_products_and_variations() public static method

Search for product variations and return json.
See also: WC_AJAX::json_search_products()

load_order_items() public static method

Load order items via ajax.
public static load_order_items ( )

load_variations() public static method

Load variations via AJAX.
public static load_variations ( )

mark_order_status() public static method

Mark an order with a status.
public static mark_order_status ( )

product_ordering() public static method

Based on Simple Page Ordering by 10up (https://wordpress.org/plugins/simple-page-ordering/).
public static product_ordering ( )

rated() public static method

Triggered when clicking the rating footer.
public static rated ( )

reduce_order_item_stock() public static method

Reduce order item stock.
public static reduce_order_item_stock ( )

refund_line_items() public static method

Handle a refund via the edit order screen.
public static refund_line_items ( )

remove_coupon() public static method

AJAX remove coupon on cart and checkout page.
public static remove_coupon ( )

remove_order_item() public static method

Remove an order item.
public static remove_order_item ( )

remove_order_tax() public static method

Remove an order tax.
public static remove_order_tax ( )

remove_variations() public static method

Delete variations via ajax function.
public static remove_variations ( )

revoke_access_to_download() public static method

Delete download permissions via ajax function.
public static revoke_access_to_download ( )

save_attributes() public static method

Save attributes via ajax.
public static save_attributes ( )

save_order_items() public static method

Save order items via ajax.
public static save_order_items ( )

save_variations() public static method

Save variations via AJAX.
public static save_variations ( )

shipping_classes_save_changes() public static method

Handle submissions from assets/js/wc-shipping-classes.js Backbone model.
public static shipping_classes_save_changes ( )

shipping_zone_add_method() public static method

Handle submissions from assets/js/wc-shipping-zone-methods.js Backbone model.
public static shipping_zone_add_method ( )

shipping_zone_methods_save_changes() public static method

Handle submissions from assets/js/wc-shipping-zone-methods.js Backbone model.

shipping_zone_methods_save_settings() public static method

Save method settings

shipping_zones_save_changes() public static method

Handle submissions from assets/js/wc-shipping-zones.js Backbone model.
public static shipping_zones_save_changes ( )

tax_rates_save_changes() public static method

Handle submissions from assets/js/settings-views-html-settings-tax.js Backbone model.
public static tax_rates_save_changes ( )

term_ordering() public static method

Ajax request handling for categories ordering.
public static term_ordering ( )

update_api_key() public static method

Create/Update API key.
public static update_api_key ( )

update_order_review() public static method

AJAX update order review on checkout.
public static update_order_review ( )

update_shipping_method() public static method

AJAX update shipping method on cart page.
public static update_shipping_method ( )