Introduction
The Feed Meta Object for the 2Checkout Add-On is an associative array with properties determining how the add-on should process the form submission.
$feed['meta'] = array(
'feedName' => 'Example Feed Name',
'transactionType' => 'product',
'paymentAmount' => '10',
'billingCycle_length' => '1',
'billingCycle_unit' => 'month',
'recurringTimes' => '12',
'setupFee_enabled' => true,
'setupFee' => '2',
'feedCondition' => true,
'feed_condition_object' => array(
'conditionalLogic' => array(
'actionType' => 'show',
'logicType' => 'all',
'rules' => array(
array(
'fieldId' => '9',
'operator' => 'is',
'value' => 'Approved',
),
),
),
),
'subscription_name' => 'Name',
);
Usage
We recommend accessing the $feed meta using the rgar() or rgars() functions, e.g.:
$conditional_logic_enabled = rgars( $feed, 'meta/feedCondition' );
if ( $conditional_logic_enabled ) {
// Conditional logic is enabled for this feed.
$logic_rules = rgars( $feed, 'meta/feed_condition_conditional_logic_object/conditionalLogic/rules' );
foreach ( $logic_rules as $rule ) {
// Process each conditional logic rule.
$field_id = rgar( $rule, 'fieldId' );
$operator = rgar( $rule, 'operator' );
$value = rgar( $rule, 'value' );
// Example: Use $field_id, $operator, and $value in your logic.
}
}
Properties
Property | Type | Description |
---|---|---|
feedName | string | A unique name for the feed. |
transactionType | string | The type of transaction: ‘product’ or ‘subscription’. |
paymentAmount | string | Specifies the field or merge tag to use for the payment amount. |
billingCycle_length | string | Specifies the length of the billing cycle for subscriptions. |
billingCycle_unit | string | Specifies the unit of time for the billing cycle: ‘week’, ‘month’, or ‘year’. |
recurringTimes | string | Number of billing cycles for a subscription (or leave empty for ongoing). |
setupFee_enabled | boolean | Enables a one-time setup fee for subscriptions. |
setupFee | string | Specifies the field or merge tag to use for the setup fee amount. |
feedCondition | boolean | Enables conditional logic to determine if the feed should run. |
feed_condition_object | array | Stores the conditional logic rules. |
subscription_name | string | Specifies a custom name for the subscription. |