Table of Contents


The BACT Caldera Forms plugin adds a custom processor to the CF CiviCRM plugin, and enables syncing custom data to BACT's program requirements.


Prerequisites and Configurations

  1. Please make sure event is event date is configured properly e.g.:
    • Status: Published
    • Visibility: Public
    • Publish Date: 2019-07-05 13:37:18
    • Purchase Limit: 253
    • Venue: 2162 Mountain Blvd
    • Event Area: Young Performers [x24] / Young Performers Musical Theatre Class ($335.00)
  2. Please check if CiviCRM having the same event that in open ticket event before placing an order if not then please open open-ticket event and click on the update 2 times so that it will create event and Campaign in CiviCRM database.
  3. Please Make sure all the custom fields in CiviCRM is mapped with caldera form participant processor and set the source name with the first name.
  4. Additional data only sync if event associate product having “CiviCRM Financial Type ” “Tuition”
  5. Please select available ”Additional Information Form” for event .

Technical Notes

Frontend Section (Directory Name: frontend)

File Name: frontend/class-add-caldera-form.php

In the above file we have Add_Caldera_Form class in that we have added several function and hooks. Below are the description of each hook and functions.

  1. add_action( 'wp_loaded', [ $this, 'bact_scripts_and_styles' ] );
    • Above action hook is fired once WordPress, all plugins, and the theme are fully loaded and instantiated in that we add javascript and css files on wp_load hook.
  2. add_action('wp_loaded', array( $this, 'boot_session' ), 10 );
    • Above action hook is fired once WordPress, all plugins, and the theme are fully loaded and instantiated in that we start the session
  3. add_action('wp_head', array( $this, 'hook_javascript') );
    • This hook and function is used to add the javascript and jquery files on head tag on the html page.
  4. add_action( 'wp_enqueue_scripts', array( $this, 'cf_enqueue_styles' ), 10 );
    • wp_enqueue_scripts is the proper hook to use when enqueuing items that are meant to appear on the front end. Despite the name, it is used for enqueuing both scripts and styles
  5. add_filter( 'woocommerce_loop_add_to_cart_link', array( $this, 'filter_woocommerce_loop_add_to_cart_link' ), 10, 2 );
    • We add the above filter to Modify the Add to cart button for adding Toggle (pop up calder form ) on shop page this "filter_woocommerce_loop_add_to_cart_link" replaces the add to cart button with caldera form popup if that event is having the caldera form associated with it.
  6. add_action( 'woocommerce_payment_complete', array( $this, 'civicrm_sync_additional_data' ), 10, 1 );
    • This action hook call when order and payment completed for sync the additional child data and participant data to civicrm database based on the product financial type it will add the additional data .
  7. add_action( 'woocommerce_thankyou', array( $this, 'sessions_data_unset' ), 10, 1 );
    • After completing the order we unset all the session additional data so for that session_data_unset function is called to unset the session data.
  8. add_action( 'woocommerce_after_cart_item_name', array( $this, 'caldera_form_edit_additional_data' ), 1000, 2 );
    • The above action hook is to add the edit child / and add new child buttion below the name of the cart item in cart page.
  9. add_action( 'caldera_forms_entry_saved', array( $this, 'slug_cf_store_entry_id' ), 9999, 3 );
    • The above hook is to call the slug_cf_store_entry_id function to stored the submited caldera form entry in session for data synchronisation after completing order.
  10. add_filter( 'wp_ajax_load_caldera_delete_entry', array( $this, 'load_caldera_delete_entry' ), 1000 ); add_filter( 'wp_ajax_nopriv_load_caldera_delete_entry', array( $this, 'load_caldera_delete_entry' ), 1000 );
    • When click on the delete link on the cart page the caldera_delete_entry ajax request function is called for deleting the requested caldera form entry this functionis workded for both logged in and non logged in user.
  11. add_filter( 'woocommerce_return_to_shop_redirect', array( $this,'wc_empty_cart_redirect_url') );
    • This function gets called when clicking "Return to shop" button it will unset all the session data and redirected to the shop page.
  12. add_action('wp_ajax_remove_item_from_cart', array( $this, 'remove_item_from_cart') ); add_action('wp_ajax_nopriv_remove_item_from_cart', array( $this, 'remove_item_from_cart') );
    • This ajax function gets called when we remove product on the part page

Frontend Section (Directory Name: frontend)

File Name : frontend/class-add-caldera-form-event-date.php

In the above file we have class Add_Caldera_Form_Event_Date extends QSOT_Templates class in that we have added several function and hooks

  1. add_filter( 'qsot-event-frontend-settings', array( $this, 'overtake_some_woocommerce_core_templates'),10,2);
    • The overtake_some_woocommerce_core_templates get the frontend template to use in the event selection ui.
  2. add_filter('qsot-locate-template', array(__CLASS__, 'locate_template'), 10, 4);
    • qsot template locator. checks theme first, then our templates dir to locate the template for ui selection of seating chart
  3. add_action('wp_head', array( $this, 'hook_javascript') );
    • Hook_javascript function will add all the jquery files to head tag in the page

Admin Section (Directory Name: admin)

File Name: frontend/class-caldera-form-meta-box-admin.php

In the above file we have Caldera_Form_Meta_Box_Admin class in that we have added several functions and hooks to add the metabox in admin section of event.

  1. add_action( 'add_meta_boxes', array( $this, 'calder_form_meta_box' ) );
    • To add the metabox in the admin section of the qsot_event custom post type for adding custom meta field to save the caldera form id .
  2. add_action( 'save_post', array( $this, 'caldera_form_save' ) );
    • When clicking on the publish or update button on event post the above function is called and it will save the selected caldera form id from caldera form metabox and saved in the custom meta field.