Skip to content

Commit f725611

Browse files
committed
feat: wooCommerce add to cart trigger fields added
1 parent 4022dbd commit f725611

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

includes/Triggers/WC/WCController.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function getAll()
135135
(object) ['id' => static::ORDER_UPDATED, 'title' => __('Order-Edit', 'bit-integrations'), 'note' => __('Flexible Checkout Fields are a feature available in the Pro version', 'bit-integrations')],
136136
(object) ['id' => static::ORDER_DELETED, 'title' => __('Order-Delete', 'bit-integrations'), 'note' => __('Flexible Checkout Fields are a feature available in the Pro version', 'bit-integrations')],
137137
(object) ['id' => static::RESTORE_ORDER, 'title' => __('Restore Order', 'bit-integrations'), 'isPro' => true],
138-
(object) ['id' => static::NEW_COUPON_CREATED, 'title' => __('New Coupon Created or Update', 'bit-integrations'), 'isPro' => true],
138+
(object) ['id' => static::NEW_COUPON_CREATED, 'title' => __('Coupon Created or Updated', 'bit-integrations'), 'isPro' => true],
139139
(object) ['id' => static::ORDER_STATUS_SET_TO_PENDING, 'title' => __('Order Status Set to Pending', 'bit-integrations'), 'isPro' => true],
140140
(object) ['id' => static::ORDER_STATUS_SET_TO_FAILED, 'title' => __('Order Status Set to Failed', 'bit-integrations'), 'isPro' => true],
141141
(object) ['id' => static::ORDER_STATUS_SET_TO_ON_HOLD, 'title' => __('Order Status Set to On-hold', 'bit-integrations'), 'isPro' => true],
@@ -221,6 +221,8 @@ public static function fields($id)
221221
$entity = 'review';
222222
} elseif ($id == static::NEW_COUPON_CREATED) {
223223
$entity = 'coupon';
224+
} elseif ($id == static::PRODUCT_ADD_TO_CART) {
225+
$entity = 'add_to_cart';
224226
}
225227

226228
if (empty($id)) {
@@ -255,6 +257,10 @@ public static function fields($id)
255257
case 'coupon':
256258
$fields = WCStaticFields::getCouponFields();
257259

260+
break;
261+
case 'add_to_cart':
262+
$fields = WCStaticFields::getAddToCartFields();
263+
258264
break;
259265

260266
default:

includes/Triggers/WC/WCStaticFields.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,44 @@ public static function getCouponFields()
192192
];
193193
}
194194

195+
public static function getAddToCartFields()
196+
{
197+
return [
198+
'Cart Item Key' => (object) [
199+
'fieldKey' => 'cart_item_key',
200+
'fieldName' => __('Cart Item Key', 'bit-integrations')
201+
],
202+
'Product Id' => (object) [
203+
'fieldKey' => 'product_id',
204+
'fieldName' => __('Product Id', 'bit-integrations')
205+
],
206+
'Quantity' => (object) [
207+
'fieldKey' => 'quantity',
208+
'fieldName' => __('Quantity', 'bit-integrations')
209+
],
210+
'Variation Id' => (object) [
211+
'fieldKey' => 'variation_id',
212+
'fieldName' => __('Variation Id', 'bit-integrations')
213+
],
214+
'Variation' => (object) [
215+
'fieldKey' => 'variation',
216+
'fieldName' => __('Variation', 'bit-integrations')
217+
],
218+
'Cart Item Data' => (object) [
219+
'fieldKey' => 'cart_item_data',
220+
'fieldName' => __('Cart Item Data', 'bit-integrations')
221+
],
222+
'Cart Total' => (object) [
223+
'fieldKey' => 'cart_total',
224+
'fieldName' => __('Cart Total', 'bit-integrations')
225+
],
226+
'Cart Line Items' => (object) [
227+
'fieldKey' => 'cart_line_items',
228+
'fieldName' => __('Cart Line Items', 'bit-integrations')
229+
]
230+
];
231+
}
232+
195233
private static function getOrderACFFields($type = [])
196234
{
197235
if (!class_exists('ACF')) {

0 commit comments

Comments
 (0)