1. Home
  2. WooCommerce Shipping Calculator
  3. Developer Documentation

Template functions

The WooCommerce Shipping Calculator plugin contains the following template functions.

wsc_display_shipping_calculator

This function outputs the shipping calculator.
This function should be used directly on your child theme template file.

// Display the shipping calculator.
wsc_display_shipping_calculator();

wsc_load_using_ajax

Verifies if the shipping calculator is being loaded using AJAX.

// Verifies if the shipping calculator is being loaded using AJAX.
if ( wsc_load_using_ajax() ) {
    // Do something.
}

wsc_is_shipping_calculator

Verifies if the current page is the product page where the shipping calculator is shown.

// Verify if we are on a page where the shipping calculator can be used.
if ( wsc_is_shipping_calculator() {
    // Do something.
    wsc_display_shipping_calculator();
}

wsc_is_shipping_calculator_ajax_call

Verifies if it is an ajax call made by the shipping calculator on the product page.

// Verify if the AJAX call was made by the shipping calculator.
if ( wsc_is_shipping_calculator_ajax_call() {
    // Do something.
    ...
}

wsc_get_setting

Gets a plugin setting.

// Gets the chosen position defined on the admin settings area.
$position = wsc_get_setting( 'position' );

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.