Below, you’ll find a detailed guide on how to add the Funnel Builder Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Funnel Builder Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Funnel Builder Plugin and the shortcodes it provides:
"Funnel Builder for WordPress by FunnelKit is a dynamic tool that enables you to customize WooCommerce checkout pages, create sales funnels and maximize profits effectively."
- [wfacp_gutenberg_mini_cart]
- [wfacp_gutenberg_checkout_form]
- [wfacp_forms]
- [wfacp_order_custom_field]
- [wfacp_order_total]
- [wfop_]
- [wfty_order_number]
- [wfty_customer_first_name]
- [wfty_customer_last_name]
- [wfty_customer_email]
- [wfty_customer_phone_number]
- [wfty_customer_details]
- [wfty_order_details]
- [wfty_order_total]
Funnel Builder [wfacp_gutenberg_mini_cart] Shortcode
The ‘wfacp_gutenberg_mini_cart’ shortcode is a part of the funnel-builder plugin. It’s designed to display a mini cart on your website. However, the function ‘print_mini_cart’ currently returns an empty string, meaning no content will be displayed. This function needs to be customized to provide the desired output.
Shortcode: [wfacp_gutenberg_mini_cart]
Examples and Usage
Basic example – A simple usage of the shortcode to print a mini cart with no additional parameters.
[wfacp_gutenberg_mini_cart /]
PHP Function Code
In case you have difficulties debugging what causing issues with [wfacp_gutenberg_mini_cart]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wfacp_gutenberg_mini_cart', [ $this, 'print_mini_cart' ], 10 );
Shortcode PHP function:
function print_mini_cart( $attr ) {
return '';
}
Code file location:
funnel-builder/funnel-builder/modules/checkouts/builder/gutenberg/class-wfacp-gutenberg-template.php
Funnel Builder [wfacp_gutenberg_checkout_form] Shortcode
The WFACP_Gutenberg_Checkout_Form shortcode is a powerful tool in the WooCommerce Funnel Builder plugin. It dynamically generates a checkout form based on unique IDs. This shortcode fetches and displays a checkout form with attributes defined by a unique ID. It merges default and custom form attributes, then renders the form using the appropriate template. It also sets session data for the form, allowing for persistent customizations.
Shortcode: [wfacp_gutenberg_checkout_form]
Parameters
Here is a list of all possible wfacp_gutenberg_checkout_form shortcode parameters and attributes:
uniqueid
– Specific identifier for differentiating multiple checkout forms
Examples and Usage
Basic example – The shortcode ‘wfacp_gutenberg_checkout_form’ is used to display a checkout form on your page. It requires a unique id attribute to function correctly.
[wfacp_gutenberg_checkout_form uniqueid="1234" /]
Advanced examples
Using the shortcode to display a checkout form with additional parameters. These parameters can be used to customize the form to suit your needs. In this example, we are adding the ‘preview’ parameter to display a preview of the checkout form.
[wfacp_gutenberg_checkout_form uniqueid="1234" preview="true" /]
Another advanced usage of the shortcode is to display a checkout form with a specific template. You can do this by adding the ‘template’ parameter and specifying the template you want to use. In this example, we are using the ‘basic’ template.
[wfacp_gutenberg_checkout_form uniqueid="1234" template="basic" /]
Remember, the ‘uniqueid’ attribute is required for the shortcode to function correctly. The other attributes are optional and can be used to customize the checkout form to suit your needs.
PHP Function Code
In case you have difficulties debugging what causing issues with [wfacp_gutenberg_checkout_form]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wfacp_gutenberg_checkout_form', [ $this, 'print_checkout_form' ], 10 );
Shortcode PHP function:
function print_checkout_form( $attr ) {
if ( ! isset( $attr['uniqueid'] ) || empty( $attr['uniqueid'] ) ) {
return '';
}
global $wp_query;
if ( isset( $wp_query->query['preview'] ) && 'true' === $wp_query->query['preview'] ) {
$post = $wp_query->posts[0];
} else {
$post = get_post( WFACP_Common::get_id() );
}
$unique_id = $attr['uniqueid'];
$blocks = $this->get_blocks_attr( $post );
$attributes = $blocks[ $unique_id ];
WFACP_Gutenberg::set_locals( 'wfacp_form', $attr['uniqueid'] );
$section_data = WFACP_GutenBerg::register_section_fields();
$section_classes = WFACP_GutenBerg::class_section();
$form_attr = isset( $section_data['attributes'] ) ? $section_data['attributes'] : [];
$classes_attr = isset( $section_classes['attributes'] ) ? $section_classes['attributes'] : [];
$default_attr = array_merge( WFACP_GutenBerg::form_attributes(), $form_attr, $classes_attr );
$settings = wp_parse_args( $attributes, $default_attr );
$template = wfacp_template();
// $id = $this->get_id();
if ( WFACP_Common::is_theme_builder() ) {
do_action( 'wfacp_form_widgets_gutenberg_editor', $this );
}
WFACP_Common::set_session( $unique_id, $settings );
$template->set_form_data( $settings );
ob_start();
include $template->wfacp_get_form();
return ob_get_clean();
}
Code file location:
funnel-builder/funnel-builder/modules/checkouts/builder/gutenberg/class-wfacp-gutenberg-template.php
Funnel Builder [wfacp_forms] Shortcode
The ‘wfacp_forms’ shortcode is used to manage the display and functionality of checkout forms in WooCommerce. It handles various scenarios, like checking if the cart is null, executing the WooCommerce checkout shortcode, and managing form shortcodes.
Shortcode: [wfacp_forms]
Parameters
Here is a list of all possible wfacp_forms shortcode parameters and attributes:
id
– Unique identifier of the checkout formlightbox
– Determines if the form will display in a lightboxwidth
– Sets the width of the formmode
– Specifies the device type the form is suited forproduct_ids
– Specifies the products to be added to the formproduct_qtys
– Defines the quantity of each product in the form
Examples and Usage
Basic example – The shortcode displays a checkout form by referencing its ID.
[wfacp_forms id=1 /]
Advanced examples
Using the shortcode to display a checkout form with specific parameters. Here, the ‘lightbox’ parameter is set to ‘yes’, the ‘width’ is set to 600, and the ‘mode’ is set to ‘all’. This means the checkout form will appear in a lightbox with a width of 600 pixels, and it will be visible on all devices.
[wfacp_forms id=1 lightbox='yes' width=600 mode='all' /]
Using the shortcode to display a checkout form with specific product IDs and quantities. In this example, the ‘product_ids’ parameter is set to ‘2,3,4’, and the ‘product_qtys’ parameter is set to ‘1,2,1’. This means the checkout form will pre-fill with the products with IDs 2, 3, and 4, with quantities 1, 2, and 1 respectively.
[wfacp_forms id=1 product_ids='2,3,4' product_qtys='1,2,1' /]
Using the shortcode to display a checkout form with a specific mode. Here, the ‘mode’ parameter is set to ‘mobile’. This means the checkout form will only be visible on mobile devices.
[wfacp_forms id=1 mode='mobile' /]
PHP Function Code
In case you have difficulties debugging what causing issues with [wfacp_forms]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wfacp_forms', [ $this, 'shortcode' ] );
Shortcode PHP function:
function shortcode( $attributes ) {
if ( is_null( WC()->cart ) || true == apply_filters( 'wfacp_do_not_allow_shortcode_printing', false ) ) {
return '';
}
// If execute woocommerce_checkout shortcode in case of thankyou & pay page open . This issue comes when client use Embed shortcode native woocommerce checkout page directly
if ( true === $this->is_received_page ) {
return do_shortcode( '[woocommerce_checkout]' );
}
$template = wfacp_template();
if ( $template instanceof WFACP_Template_Common ) {
global $post;
if ( ! is_null( $post ) && $post->post_type == WFACP_Common::get_post_type_slug() ) {
// checking template support Shortcode execution
add_filter( 'wfacp_skip_form_printing', '__return_false' );
ob_start();
$this->get_form_shortcode_html( $template, WFACP_Core()->public->is_checkout_override() );
return ob_get_clean();
}
}
$attributes = shortcode_atts( [
'id' => 0,
'lightbox' => 'no',
'width' => 500,
'mode' => 'all',
'product_ids' => '',
'product_qtys' => '',
], $attributes );
$wfacp_id = $attributes['id'];
$lightbox = $attributes['lightbox'];
if ( '' !== $attributes['product_ids'] ) {
$aero_add_to_checkout_parameter = WFACP_Core()->public->aero_add_to_checkout_parameter();
$_GET[ $aero_add_to_checkout_parameter ] = trim( $attributes['product_ids'] );
}
if ( '' !== $attributes['product_qtys'] ) {
$aero_add_to_checkout_product_quantity_parameter = WFACP_Core()->public->aero_add_to_checkout_product_quantity_parameter();
$_GET[ $aero_add_to_checkout_product_quantity_parameter ] = trim( $attributes['product_qtys'] );
}
$data = WFACP_Common::get_page_design( $wfacp_id );
if ( empty( $data ) || 'embed_forms' !== $data['selected_type'] ) {
return '';
}
if ( 0 === $this->wfacp_id ) {
$this->wfacp_id = absint( $wfacp_id );
if ( 0 == $this->wfacp_id ) {
return '';
}
$temp_post = get_post( $this->wfacp_id );
if ( is_null( $temp_post ) ) {
return '';
}
if ( ! is_super_admin() ) {
if ( ( 'publish' !== $temp_post->post_status || $temp_post->post_type !== WFACP_Common::get_post_type_slug() ) ) {
return '';
}
}
// Normal checkout page (Woocommerce setting checkout page)
if ( ( is_checkout() || ( $this->current_page_id > 0 && $this->current_page_id == WFACP_Common::get_checkout_page_id() ) ) && false == $this->page_is_editable ) {
remove_action( 'wfacp_after_checkout_page_found', [ WFACP_Core()->public, 'add_to_cart' ], 2 );
do_action( 'wfacp_changed_default_woocommerce_page' );
}
add_filter( 'wfacp_skip_add_to_cart', [ $this, 'skip_add_to_cart' ] );
$this->remove_hooks();
add_filter( 'wfacp_enqueue_global_script', '__return_true' );
add_filter( 'wfacp_cancel_url_arguments', [ $this, 'add_embed_page_id' ] );
add_filter( 'woocommerce_is_checkout', '__return_true' );
add_filter( 'wfacp_remove_woocommerce_style_dependency', '__return_true' );
add_filter( 'wfacp_skip_form_printing', '__return_true', 10 );
if ( 'yes' == $lightbox ) {
add_action( 'wp_enqueue_scripts', [ $this, 'remove_select2_wc' ], 100 );
self::$pop_up_trigger = true;
}
WFACP_Common::set_id( $this->wfacp_id );
$get_template_loader = WFACP_Core()->template_loader;
$get_template_loader->load_template( $this->wfacp_id );
$this->current_template = $get_template_loader->get_template_ins();
if ( ! is_null( $this->current_template ) && $this->current_template instanceof WFACP_Template_Common ) {
remove_filter( 'template_redirect', array( $get_template_loader, 'setup_preview' ), 99 );
// Remove assign template function because of shortcode embed on other page
global $post;
if ( ! is_null( $post ) && $post->ID !== $this->wfacp_id ) {
remove_filter( 'template_include', array( $get_template_loader, 'assign_template' ), 95 );
}
add_action( 'wfacp_after_payment_section', [ $this, 'create_hidden_input_for_saving_current_page_id' ] );
$this->current_template->get_customizer_data();
WFACP_Core()->public->add_to_cart_action( $this->wfacp_id );
do_action( 'wfacp_after_checkout_page_found', $this->wfacp_id );
}
return '';
} else {
/** Don't execute shortcode if mode is mobile and a user not came from mobile */
if ( 'mobile' == $attributes['mode'] && ! wp_is_mobile() ) {
return '';
}
/** Don't execute shortcode if mode is desktop and a user came from mobile */
if ( 'desktop' == $attributes['mode'] && wp_is_mobile() ) {
return '';
}
if ( ! $this->current_template instanceof WFACP_Template_Common ) {
return '';
}
add_filter( 'wfacp_skip_form_printing', '__return_false' );
ob_start();
if ( 'yes' == $lightbox ) {
$this->wrap_in_light_box();
} else {
include $this->current_template->get_template_url();
}
return ob_get_clean();
}
}
Code file location:
funnel-builder/funnel-builder/modules/checkouts/includes/class-embed-form-loader.php
Funnel Builder [wfacp_order_custom_field] Shortcode
The WFACP Order Custom Field shortcode is designed to retrieve specific order-related data. It fetches data like billing and shipping details, using the order_id and field_id attributes. If the type attribute is set to ‘value’, it retrieves the metadata of the order. If not, it fetches the label of the specified field from the checkout fields. The shortcode returns an empty string if the order ID or field ID is invalid.
Shortcode: [wfacp_order_custom_field]
Parameters
Here is a list of all possible wfacp_order_custom_field shortcode parameters and attributes:
order_id
– Identifies the specific order you want to retrievefield_id
– Specifies the field data you wish to access from the ordertype
– Determines whether to return the field’s value or label
Examples and Usage
Basic example – A simple usage of the shortcode that displays the value of a custom field from an order. The shortcode requires the order ID and the field ID as parameters.
[wfacp_order_custom_field order_id=123 field_id="billing_email" /]
Advanced examples
Displaying the label of a custom field from an order. This requires specifying the ‘type’ parameter as ‘label’.
[wfacp_order_custom_field order_id=123 field_id="billing_email" type="label" /]
Using the shortcode to display a custom field value from the current order. This uses the ‘order_id’ parameter set to 0, which tells the shortcode to use the current order ID from the request.
[wfacp_order_custom_field order_id=0 field_id="billing_email" /]
Displaying a shipping field from an order. This requires specifying the field ID as one of the shipping fields.
[wfacp_order_custom_field order_id=123 field_id="shipping_country" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [wfacp_order_custom_field]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wfacp_order_custom_field', [ __CLASS__, 'wfacp_order_custom_field' ] );
Shortcode PHP function:
function wfacp_order_custom_field( $atts ) {
$atts = shortcode_atts( array(
'order_id' => 0,
'field_id' => '',
'type' => 'value',
), $atts );
$field = $atts['field_id'];
if ( '' == $field ) {
return '';
}
$order_id = absint( $atts['order_id'] );
if ( 0 === $order_id && isset( $_REQUEST['order_id'] ) && absint( $_REQUEST['order_id'] ) > 0 ) {
$order_id = absint( $_REQUEST['order_id'] );
}
$order_id = apply_filters( 'wfacp_custom_field_order_id', $order_id );
if ( empty( $order_id ) ) {
return '';
}
$meta_keys = [
'billing_email',
'billing_first_name',
'billing_last_name',
'billing_phone',
'billing_country',
'billing_city',
'billing_address_1',
'billing_address_2',
'billing_postcode',
'billing_company',
'billing_state',
'shipping_first_name',
'shipping_last_name',
'shipping_phone',
'shipping_country',
'shipping_city',
'shipping_address_1',
'shipping_address_2',
'shipping_postcode',
'shipping_state',
];
$order = wc_get_order( $order_id );
if ( $atts['type'] == 'value' ) {
if ( in_array( $field, $meta_keys ) ) {
$field = '_' . $field;
}
$metadata = wfacp_get_order_meta( $order, $field );
if ( is_string( $metadata ) ) {
return $metadata;
}
} else {
$fpos = strpos( $field, '_' );
if ( 0 === $fpos ) {
$field = substr( $field, 1, strlen( $field ) );
}
$wfacp_id = wfacp_get_order_meta( $order, '_wfacp_post_id' );
if ( empty( $wfacp_id ) ) {
return '';
}
$wfacp_id = absint( $wfacp_id );
$checkout_fields = get_post_meta( $wfacp_id, '_wfacp_checkout_fields', true );
if ( ! is_array( $checkout_fields ) || count( $checkout_fields ) == 0 ) {
return '';
}
foreach ( $checkout_fields as $field_typ => $fieldset ) {
foreach ( $fieldset as $field_key => $field_vl ) {
$pos = strpos( $field_key, '_' );
if ( 0 === $pos ) {
$field_key = substr( $field_key, 1, strlen( $field_key ) );
}
if ( $field_key === $field ) {
return $field_vl['label'];
}
}
}
}
return '';
}
Code file location:
funnel-builder/funnel-builder/modules/checkouts/includes/class-wfacp-common.php
Funnel Builder [wfacp_order_total] Shortcode
The Woocommerce Funnel Builder shortcode is a code snippet that fetches and displays the total amount in the shopping cart. The shortcode, when embedded in a page, calls the ‘wfacp_order_total’ function. This function checks if a cart exists and if it does, it retrieves the total amount. The ‘with_html’ attribute in the shortcode allows you to choose whether to display the total with HTML formatting or not.
Shortcode: [wfacp_order_total]
Parameters
Here is a list of all possible wfacp_order_total shortcode parameters and attributes:
with_html
– Determines if the cart total includes HTML or not.
Examples and Usage
Basic Example – A fundamental usage of the shortcode to display the order total from the WooCommerce cart.
[wfacp_order_total /]
Advanced Examples
Using the shortcode to display the order total from the WooCommerce cart with HTML tags. This can be useful if you want to style the output in a specific way using CSS.
[wfacp_order_total with_html=yes /]
Using the shortcode to display the order total from the WooCommerce cart without HTML tags. This can be beneficial if you want to display the plain text order total without any additional formatting.
[wfacp_order_total with_html=no /]
PHP Function Code
In case you have difficulties debugging what causing issues with [wfacp_order_total]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wfacp_order_total', [ __CLASS__, 'wfacp_order_total' ] );
Shortcode PHP function:
function wfacp_order_total( $atts ) {
$atts = shortcode_atts( array(
'with_html' => 'no',
), $atts );
if ( is_null( WC()->cart ) ) {
return '';
}
if ( 'yes' == $atts['with_html'] ) {
$cart_total = WC()->cart->get_total();
} else {
$cart_total = strip_tags( WC()->cart->get_total() );
}
return $cart_total;
}
Code file location:
funnel-builder/funnel-builder/modules/checkouts/includes/class-wfacp-common.php
Funnel Builder [wfty_order_number] Shortcode
The WFTY Order Number shortcode is a crucial part of the funnel-builder plugin. It’s designed to fetch and display the order ID from the database.
Shortcode: [wfty_order_number]
Examples and Usage
Basic example – The shortcode ‘wfty_order_number’ is used to fetch the order number from the system.
[wfty_order_number /]
PHP Function Code
In case you have difficulties debugging what causing issues with [wfty_order_number]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wfty_order_number', array( WFFN_Core()->thank_you_pages->data, 'get_order_id' ) );
Shortcode PHP function:
function get_order_id() {
return $this->order_id;
}
Code file location:
funnel-builder/funnel-builder/modules/thankyou-pages/includes/class-wfty-shortcodes.php
Funnel Builder [wfty_customer_first_name] Shortcode
The ‘wfty_customer_first_name’ shortcode retrieves the first name of a customer from an order. It checks if an order exists, if not, it returns dummy data. If an order is found, it uses WFTY_Woo_Order_Data to fetch the customer’s first name.
Shortcode: [wfty_customer_first_name]
Examples and Usage
Basic example – A shortcode that retrieves and displays the customer’s first name from the order data.
[wfty_customer_first_name /]
PHP Function Code
In case you have difficulties debugging what causing issues with [wfty_customer_first_name]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wfty_customer_first_name', array( WFFN_Core()->thank_you_pages->data, 'get_customer_first_name' ) );
Shortcode PHP function:
function get_customer_first_name() {
if ( false === $this->get_order() ) {
return $this->dummy_order_data['first_name'];
}
if ( $this->order_id && $this->order ) {
return WFTY_Woo_Order_Data::get_customer_first_name( $this->order );
}
}
Code file location:
funnel-builder/funnel-builder/modules/thankyou-pages/includes/class-wfty-shortcodes.php
Funnel Builder [wfty_customer_last_name] Shortcode
The ‘wfty_customer_last_name’ shortcode is used to retrieve the last name of a customer from an order. It queries the order data and if no order is found, it returns dummy data. It’s part of the Funnel Builder plugin for WordPress.
Shortcode: [wfty_customer_last_name]
Examples and Usage
Basic example – A simple way to use the shortcode to display the last name of the customer associated with the order.
[wfty_customer_last_name /]
Advanced examples
Using the shortcode to display the last name of the customer based on the order ID. In this case, the order ID is passed as a parameter to the shortcode.
[wfty_customer_last_name order_id=123 /]
Another advanced usage could be to use the shortcode to display the last name of the customer associated with the order, but if the order is not found, it will display a default last name. The default last name is passed as a parameter to the shortcode.
[wfty_customer_last_name default_last_name="Doe" /]
Please note that these advanced examples assume that the ‘get_customer_last_name’ function is modified to accept parameters and handle these scenarios. If these functionalities are not present in the current version of the function, you would need to update the function accordingly.
PHP Function Code
In case you have difficulties debugging what causing issues with [wfty_customer_last_name]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wfty_customer_last_name', array( WFFN_Core()->thank_you_pages->data, 'get_customer_last_name' ) );
Shortcode PHP function:
function get_customer_last_name() {
if ( false === $this->get_order() ) {
return $this->dummy_order_data['last_name'];
}
if ( $this->order_id && $this->order ) {
return WFTY_Woo_Order_Data::get_customer_last_name( $this->order );
}
}
Code file location:
funnel-builder/funnel-builder/modules/thankyou-pages/includes/class-wfty-shortcodes.php
Funnel Builder [wfty_customer_email] Shortcode
The ‘wfty_customer_email’ shortcode retrieves the customer’s email from an order. If no order is found, it defaults to a dummy email.
Shortcode: [wfty_customer_email]
Examples and Usage
Basic Example – Showcases a simple usage of the shortcode to retrieve the customer’s email.
[wfty_customer_email]
PHP Function Code
In case you have difficulties debugging what causing issues with [wfty_customer_email]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wfty_customer_email', array( WFFN_Core()->thank_you_pages->data, 'get_customer_email' ) );
Shortcode PHP function:
function get_customer_email() {
if ( false === $this->get_order() ) {
return $this->dummy_order_data['email'];
}
if ( $this->order_id && $this->order ) {
return WFTY_Woo_Order_Data::get_customer_email( $this->order );
}
}
Code file location:
funnel-builder/funnel-builder/modules/thankyou-pages/includes/class-wfty-shortcodes.php
Funnel Builder [wfty_customer_details] Shortcode
The ‘wfty_customer_details’ shortcode retrieves customer information from the WooCommerce Thank You page. It checks if the user has access and if an order exists. If not, it displays an error or dummy data.
Shortcode: [wfty_customer_details]
Examples and Usage
Basic example – Display customer details with the default arguments.
[wfty_customer_details]
PHP Function Code
In case you have difficulties debugging what causing issues with [wfty_customer_details]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wfty_customer_details', array( WFFN_Core()->thank_you_pages->data, 'get_customer_info' ) );
Shortcode PHP function:
function get_customer_info( $args ) {
if ( is_string( $args ) ) {
$args = [];
}
$user = WFFN_Core()->role->user_access( 'funnel', 'read' );
if ( false === $this->get_order() ) {
if ( ( false === $user ) && ( false === apply_filters( 'wffn_show_dummy_ty_order_data', false ) ) ) {
return $this->show_error_message();
}
return WFTY_Woo_Order_Data::get_dummy_customer_details( $this->dummy_order_data, $args );
}
if ( $this->order && ( true === apply_filters( 'wffn_show_customer_info_non_logged_user', true, $this->order ) ) ) {
return WFTY_Woo_Order_Data::get_customer_details( $this->get_order(), $args );
}
}
Code file location:
funnel-builder/funnel-builder/modules/thankyou-pages/includes/class-wfty-shortcodes.php
Funnel Builder [wfty_order_details] Shortcode
The WFTY Order Details shortcode is a function of the WFTY plugin. It retrieves order details based on user access rights. This shortcode first checks if the user has ‘read’ access to the funnel. If the order can’t be retrieved or the user doesn’t have proper access, an error message is shown. If the order exists, it fetches the order details.
Shortcode: [wfty_order_details]
Examples and Usage
Basic example – Displays the default order details without any additional parameters.
[wfty_order_details]
PHP Function Code
In case you have difficulties debugging what causing issues with [wfty_order_details]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wfty_order_details', array( WFFN_Core()->thank_you_pages->data, 'get_order_details' ) );
Shortcode PHP function:
function get_order_details( $args ) {
if ( is_string( $args ) ) {
$args = [];
}
$user = WFFN_Core()->role->user_access( 'funnel', 'read' );
//Unable to get Order & User or Guest doesn't have funnel read permission.
if ( false === $this->get_order() ) {
if ( ( false === $user ) && ( false === apply_filters( 'wffn_show_dummy_ty_order_data', false ) ) ) {
return $this->show_error_message();
}
return WFTY_Woo_Order_Data::get_dummy_order_details( $args );
}
if ( $this->order ) {
return WFTY_Woo_Order_Data::get_order_details( $this->order, $args );
}
}
Code file location:
funnel-builder/funnel-builder/modules/thankyou-pages/includes/class-wfty-shortcodes.php
Funnel Builder [wfty_order_total] Shortcode
The ‘wfty_order_total’ shortcode from the Funnel Builder plugin is a powerful tool that retrieves the total cost of a specific order. This shortcode uses an order ID to fetch and return the corresponding order’s total. If no ID is provided or if the ID is invalid, it will return an empty string. It also supports custom filters, allowing for greater flexibility.
Shortcode: [wfty_order_total]
Parameters
Here is a list of all possible wfty_order_total shortcode parameters and attributes:
order_id
– The unique identifier of the order
Examples and Usage
Basic example – A simple usage of the wfty_order_total shortcode. This will return the total amount of the order with the specified id.
[wfty_order_total order_id=123]
Advanced examples
In this example, we’re using the wfty_order_total shortcode without specifying the order_id attribute. This will make the shortcode return the total amount of the order id that is currently being requested.
[wfty_order_total]
In this next example, we’re using the wfty_order_total shortcode alongside a filter to dynamically change the order_id that the shortcode is referring to. This can be useful in situations where you want to display the total amount of a different order based on certain conditions.
function change_order_id( $order_id ) {
return 456; // Change this to the id of the order you want to display
}
add_filter( 'wfty_custom_field_order_id', 'change_order_id' );
[wfty_order_total]
PHP Function Code
In case you have difficulties debugging what causing issues with [wfty_order_total]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wfty_order_total', array( WFFN_Core()->thank_you_pages->data, 'get_order_total' ) );
Shortcode PHP function:
function get_order_total( $atts ) {
$atts = shortcode_atts( array(
'order_id' => 0,
), $atts );
$order_id = absint( $atts['order_id'] );
if ( $order_id == 0 ) {
if ( isset( $_REQUEST['order_id'] ) && $_REQUEST['order_id'] > 0 ) {
$order_id = absint( $_REQUEST['order_id'] );
}
}
$order_id = apply_filters( 'wfty_custom_field_order_id', $order_id );
if ( $order_id == 0 ) {
return '';
}
$metadata = BWF_WC_Compatibility::get_order_meta( wc_get_order( $order_id ), '_order_total' );
if ( is_string( $metadata ) ) {
return $metadata;
}
return '';
}
Code file location:
funnel-builder/funnel-builder/modules/thankyou-pages/includes/class-wfty-shortcodes.php
Conclusion
Now that you’ve learned how to embed the Funnel Builder Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply