Created
December 30, 2025 05:49
-
-
Save aimahdi/d818021ea73e7d5f5dd8e512a6f53e34 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, $customer) { | |
| // 1️⃣ Affiliate form widget (unchanged) | |
| $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' => '' | |
| ] | |
| ]; | |
| // 2️⃣ Affiliate chart widget (converted to pie) | |
| $widgets[] = [ | |
| 'title' => __('Fluent Affiliate Chart', 'fluent-affiliate'), | |
| 'sub_title' => __('Affiliate performance distribution', 'fluent-affiliate'), | |
| 'type' => 'chart', | |
| 'form_name' => 'fa_affiliate_form', | |
| 'name' => 'affiliate', | |
| 'height' => '500px', | |
| 'data' => [ | |
| 'tooltip' => [ | |
| 'trigger' => 'item' | |
| ], | |
| 'legend' => [ | |
| 'orient' => 'vertical', | |
| 'left' => 'left' | |
| ], | |
| 'series' => [[ | |
| 'name' => __('Performance', 'fluent-affiliate'), | |
| 'type' => 'pie', | |
| 'radius' => '60%', | |
| 'data' => [ | |
| ['value' => 320, 'name' => 'Clicks'], | |
| ['value' => 150, 'name' => 'Conversions'], | |
| ['value' => 90, 'name' => 'Leads'], | |
| ['value' => 60, 'name' => 'Referrals'], | |
| ], | |
| 'emphasis' => [ | |
| 'itemStyle' => [ | |
| 'shadowBlur' => 10, | |
| 'shadowOffsetX' => 0, | |
| 'shadowColor' => 'rgba(0, 0, 0, 0.5)' | |
| ] | |
| ] | |
| ]] | |
| ] | |
| ]; | |
| return $widgets; | |
| }, 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment