Created
November 11, 2025 06:49
-
-
Save aimahdi/8940ba465ee58b51735fe764135b0e09 to your computer and use it in GitHub Desktop.
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_filter('fluent_cart/widgets/single_product_page', function ($widgets, $product) { | |
| $product = \FluentCart\App\Models\Product::find($product['product_id']); | |
| $value = $product->getMeta('_affiliate_form'); | |
| $widgets[] = [ | |
| 'title' => __('Fluent Affiliate', 'fluent-affiliate'), | |
| 'sub_title' => __('Select Affiliate you want to add to cart', 'fluent-affiliate'), | |
| 'type' => 'form', | |
| 'form_name' => 'fa_affiliate_form', | |
| 'name' => 'affiliate', | |
| 'schema' => [ | |
| 'name' => [ | |
| 'wrapperClass' => 'col-span-2 flex items-start flex-col', | |
| 'remote_key' => 'affiliate', | |
| 'label' => __('Select Affiliate', 'fluent-affiliate'), | |
| 'type' => 'remote_select', | |
| 'options' => [], | |
| ], | |
| ], | |
| 'values' => [ | |
| 'name' => 'Mahdi' | |
| ] | |
| ]; | |
| return $widgets; | |
| }, 10, 2); | |
| add_filter('fluent_cart/get_dynamic_search_affiliate', function($data){ | |
| $data = [ | |
| [ | |
| 'value' =>1, | |
| 'label' => 'Tanbir' | |
| ], | |
| [ | |
| 'value' =>2, | |
| 'label' => 'Mahdi' | |
| ] | |
| ]; | |
| return $data; | |
| }, 10, 1); | |
| add_action('fluent_cart/product_updated', function($data){ | |
| $product = $data['product']; | |
| $formData = $data['data']['metaValue']['fa_affiliate_form']['name']; | |
| $product->updateMeta('_affiliate_form', $data['data']['metaValue']['fa_affiliate_form']['name']); | |
| }, 10, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment