This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action('fluent_cart/before_payment_methods', function($args) { | |
| // Add your field here..... | |
| // Example Field | |
| $termsText = 'Yes, I\'d like to receive emails with exclusive offers and updates.'; | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <? | |
| add_filter('fluent_cart/shop_query', function ($query, $params) { | |
| if (is_admin()) { | |
| return $query; | |
| } | |
| // Term IDs to exclude (product-categories) | |
| $excluded_ids = [11]; | |
| $query->whereDoesntHave('wp_terms', function ($rel) use ($excluded_ids) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('gettext', function ($text) { | |
| return $text.' (yap)'; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('fluent_cart/product_download/can_be_downloaded', function($canBeDownloaded, $orderInfo){ | |
| }, 10, 2); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function calculateAmount($subtotal, $discount){ | |
| $finalSubtotal = round(($subtotal /1.15), 2); | |
| echo "Subtotal: {$finalSubtotal}\n"; | |
| $finalDiscount = round(($discount / 1.15), 2); | |
| echo "Discount: {$finalDiscount}\n"; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('fluentform/validate_input_item_input_checkbox', function($validation, $field, $formData, $fields, $form) { | |
| // Do your stuff here | |
| // | |
| $formId = $form->id; | |
| if($formId != 6) return $validation; // Change the form id here | |
| $count = count($formData['checkbox']); //replace checkbox with the name attribute of the field |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('fluentform/rendering_field_data_input_email', 'add_accessibility_attributes_to_email_field', 10, 2); | |
| function add_accessibility_attributes_to_email_field($data, $form) | |
| { | |
| // Only target a specific form | |
| if ($form->id != 327) { | |
| return $data; | |
| } | |
| $data['attributes']['autocomplete'] = 'email'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.onload= function () { | |
| flatpickr('.fp', { | |
| enableTime: true, | |
| dateFormat: "Y-m-d H:i", | |
| onReady: updateLimits, | |
| onChange: updateLimits | |
| }); | |
| function updateLimits(selectedDates, dateStr, instance) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function get_fluentform_schedule_dates( $form_id ) { | |
| global $wpdb; | |
| if ( ! $form_id ) { | |
| return 'Invalid form ID.'; | |
| } | |
| $table_name = $wpdb->prefix . 'fluentform_form_meta'; | |
| // Get all meta for the form |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action('fluentform/loaded', function ($app) { | |
| $app->router->post('/submit-form', function () use ($app) { | |
| try { | |
| $data = $app->request->get('data'); | |
| $data['_wp_http_referer'] = isset($data['_wp_http_referer']) ? sanitize_url(urldecode($data['_wp_http_referer'])) : ''; | |
| $app->request->merge(['data' => $data]); | |
| $formId = intval($app->request->get('form_id')); |