Skip to content

Latest commit

 

History

History
527 lines (527 loc) · 18.3 KB

ACTIONS-FILTERS.md

File metadata and controls

527 lines (527 loc) · 18.3 KB

Filters

File Filter Name Description
../includes/class-ckwc-checkout.php
  convertkit_for_woocommerce_checkout_add_opt_in_checkbox Adds the opt-in checkbox to the checkout's billing or order section, based on the Plugin's settings.
../includes/class-ckwc-order.php
  convertkit_for_woocommerce_order_maybe_subscribe_customer_resource_id Define the Form, Tag or Sequence ID to subscribe the Customer to for the given Product.
  convertkit_for_woocommerce_order_maybe_subscribe_customer_resource_id_coupon Define the Form, Tag or Sequence ID to subscribe the Customer to for the given Coupon.
  convertkit_for_woocommerce_order_maybe_subscribe_customer_subscriptions Define the Forms, Tags and/or Sequences to subscribe the Customer to for this Order.
  convertkit_for_woocommerce_order_send_purchase_data Define the data to send to the ConvertKit API to create a Purchase in ConvertKit https://developers.convertkit.com/#create-a-purchase
  convertkit_for_woocommerce_order_should_opt_in_customer Determine if the Customer should be opted in to ConvertKit. If the Order already opted in the Customer, this filter will not be fired. If the Order does not permit the Customer be opted in (i.e. they declined at checkout), this filter will not be fired.
  convertkit_for_woocommerce_email Returns the customer's email address for the given WooCommerce Order, immediately before it is sent to ConvertKit when subscribing the Customer to a Form, Tag or Sequence.
  convertkit_for_woocommerce_order_name Returns the customer's name for the given WooCommerce Order, immediately before it is sent to ConvertKit when subscribing the Customer to a Form, Tag or Sequence, or sending Purchase Data.
  convertkit_for_woocommerce_first_name Returns the customer's first name for the given WooCommerce Order, immediately before it is sent to ConvertKit when subscribing the Customer to a Form, Tag or Sequence.
  convertkit_for_woocommerce_last_name Returns the customer's last name for the given WooCommerce Order, immediately before it is sent to ConvertKit when subscribing the Customer to a Form, Tag or Sequence.
  convertkit_for_woocommerce_custom_field_data Returns an array of ConvertKit Custom Field Key/Value pairs, with values comprising of Order data based, to be sent to ConvertKit when an Order's Customer is subscribed via a Form, Tag or Sequence. Returns false if no Order data should be stored in ConvertKit Custom Fields.

convertkit_for_woocommerce_checkout_add_opt_in_checkbox includes/class-ckwc-checkout.php::137

Overview

Adds the opt-in checkbox to the checkout's billing or order section, based on the Plugin's settings.

Parameters

Parameter Type Description
Checkout array $fields Fields.

Usage

add_filter( 'convertkit_for_woocommerce_checkout_add_opt_in_checkbox', function( $fields ) {
	// ... your code here
	// Return value
	return $fields;
}, 10, 1 );

convertkit_for_woocommerce_order_maybe_subscribe_customer_resource_id includes/class-ckwc-order.php::149

Overview

Define the Form, Tag or Sequence ID to subscribe the Customer to for the given Product.

Parameters

Parameter Type Description
$resource_id mixed Form, Tag or Sequence ID | empty string.
$order_id int WooCommerce Order ID.
Order's string $status_new New
$product_id int Product ID.

Usage

add_filter( 'convertkit_for_woocommerce_order_maybe_subscribe_customer_resource_id', function( $resource_id, $order_id, $status_old, $status_new, $product->get_id( ) {
	// ... your code here
	// Return value
	return $resource_id;
}, 10, 5 );

convertkit_for_woocommerce_order_maybe_subscribe_customer_resource_id_coupon includes/class-ckwc-order.php::179

Overview

Define the Form, Tag or Sequence ID to subscribe the Customer to for the given Coupon.

Parameters

Parameter Type Description
$resource_id mixed Form, Tag or Sequence ID | empty string.
$order_id int WooCommerce Order ID.
Order's string $status_new New
$coupon_id int Coupon ID.

Usage

add_filter( 'convertkit_for_woocommerce_order_maybe_subscribe_customer_resource_id_coupon', function( $resource_id, $order_id, $status_old, $status_new, $coupon->get_id( ) {
	// ... your code here
	// Return value
	return $resource_id;
}, 10, 5 );

convertkit_for_woocommerce_order_maybe_subscribe_customer_subscriptions includes/class-ckwc-order.php::203

Overview

Define the Forms, Tags and/or Sequences to subscribe the Customer to for this Order.

Parameters

Parameter Type Description
$subscriptions array Subscriptions (array of Forms, Tags and/or Sequence IDs).
$order_id int WooCommerce Order ID.
Order's string $status_new New

Usage

add_filter( 'convertkit_for_woocommerce_order_maybe_subscribe_customer_subscriptions', function( $subscriptions, $order_id, $status_old, $status_new ) {
	// ... your code here
	// Return value
	return $subscriptions;
}, 10, 4 );

convertkit_for_woocommerce_order_send_purchase_data includes/class-ckwc-order.php::481

Overview

Define the data to send to the ConvertKit API to create a Purchase in ConvertKit https://developers.convertkit.com/#create-a-purchase

Parameters

Parameter Type Description
$purchase array Purchase Data.
$order_id int WooCommerce Order ID.
Order's string $status_new New

Usage

add_filter( 'convertkit_for_woocommerce_order_send_purchase_data', function( $purchase, $order_id, $status_old, $status_new ) {
	// ... your code here
	// Return value
	return $purchase;
}, 10, 4 );

convertkit_for_woocommerce_order_should_opt_in_customer includes/class-ckwc-order.php::690

Overview

Determine if the Customer should be opted in to ConvertKit. If the Order already opted in the Customer, this filter will not be fired. If the Order does not permit the Customer be opted in (i.e. they declined at checkout), this filter will not be fired.

Parameters

Parameter Type Description
$should_opt_in_customer bool Should opt in Customer.
$order_id int Order ID.

Usage

add_filter( 'convertkit_for_woocommerce_order_should_opt_in_customer', function( $should_opt_in_customer, $order->get_id( ) {
	// ... your code here
	// Return value
	return $should_opt_in_customer;
}, 10, 2 );

convertkit_for_woocommerce_email includes/class-ckwc-order.php::722

Overview

Returns the customer's email address for the given WooCommerce Order, immediately before it is sent to ConvertKit when subscribing the Customer to a Form, Tag or Sequence.

Parameters

Parameter Type Description
$email string Email Address
$order WC_Order|WC_Order_Refund Order

Usage

add_filter( 'convertkit_for_woocommerce_email', function( $email, $order ) {
	// ... your code here
	// Return value
	return $email;
}, 10, 2 );

convertkit_for_woocommerce_order_name includes/class-ckwc-order.php::777

Overview

Returns the customer's name for the given WooCommerce Order, immediately before it is sent to ConvertKit when subscribing the Customer to a Form, Tag or Sequence, or sending Purchase Data.

Parameters

Parameter Type Description
$name string Name
$order WC_Order|WC_Order_Refund Order

Usage

add_filter( 'convertkit_for_woocommerce_order_name', function( $name, $order ) {
	// ... your code here
	// Return value
	return $name;
}, 10, 2 );

convertkit_for_woocommerce_first_name includes/class-ckwc-order.php::809

Overview

Returns the customer's first name for the given WooCommerce Order, immediately before it is sent to ConvertKit when subscribing the Customer to a Form, Tag or Sequence.

Parameters

Parameter Type Description
$first_name string First Name
$order WC_Order|WC_Order_Refund Order

Usage

add_filter( 'convertkit_for_woocommerce_first_name', function( $first_name, $order ) {
	// ... your code here
	// Return value
	return $first_name;
}, 10, 2 );

convertkit_for_woocommerce_last_name includes/class-ckwc-order.php::841

Overview

Returns the customer's last name for the given WooCommerce Order, immediately before it is sent to ConvertKit when subscribing the Customer to a Form, Tag or Sequence.

Parameters

Parameter Type Description
$last_name string Last Name
$order WC_Order|WC_Order_Refund Order

Usage

add_filter( 'convertkit_for_woocommerce_last_name', function( $last_name, $order ) {
	// ... your code here
	// Return value
	return $last_name;
}, 10, 2 );

convertkit_for_woocommerce_custom_field_data includes/class-ckwc-order.php::895

Overview

Returns an array of ConvertKit Custom Field Key/Value pairs, with values comprising of Order data based, to be sent to ConvertKit when an Order's Customer is subscribed via a Form, Tag or Sequence. Returns false if no Order data should be stored in ConvertKit Custom Fields.

Parameters

Parameter Type Description
$fields mixed Custom Field Key/Value pairs (false | array).
$order WC_Order|WC_Order_Refund WooCommerce Order.

Usage

add_filter( 'convertkit_for_woocommerce_custom_field_data', function( $fields, $order ) {
	// ... your code here
	// Return value
	return $fields;
}, 10, 2 );

Actions

File Filter Name Description
../includes/class-wp-ckwc.php
  convertkit_for_woocommerce_initialize_admin
  convertkit_for_woocommerce_initialize_cli
  convertkit_for_woocommerce_initialize_frontend
  convertkit_for_woocommerce_initialize_global

convertkit_for_woocommerce_initialize_admin includes/class-wp-ckwc.php::162

Parameters

Parameter Type Description

Usage

do_action( 'convertkit_for_woocommerce_initialize_admin', function(  ) {
	// ... your code here
}, 10, 0 );

convertkit_for_woocommerce_initialize_cli includes/class-wp-ckwc.php::209

Parameters

Parameter Type Description

Usage

do_action( 'convertkit_for_woocommerce_initialize_cli', function(  ) {
	// ... your code here
}, 10, 0 );

convertkit_for_woocommerce_initialize_frontend includes/class-wp-ckwc.php::232

Parameters

Parameter Type Description

Usage

do_action( 'convertkit_for_woocommerce_initialize_frontend', function(  ) {
	// ... your code here
}, 10, 0 );

convertkit_for_woocommerce_initialize_global includes/class-wp-ckwc.php::253

Parameters

Parameter Type Description

Usage

do_action( 'convertkit_for_woocommerce_initialize_global', function(  ) {
	// ... your code here
}, 10, 0 );