flexible-shipping
/
src
/
WPDesk
/
FS
/
TableRate
/
ShippingMethod
/
Duplicate
/
DuplicateTracker.php
DuplicateAction.php
1 month ago
DuplicateNotice.php
1 month ago
DuplicateScript.php
1 month ago
DuplicateTracker.php
1 month ago
DuplicatorChecker.php
1 month ago
DuplicateTracker.php
36 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Class DuplicateTracker |
| 4 | * |
| 5 | * @package WPDesk\FS\TableRate\ShippingMethod\Duplicate |
| 6 | */ |
| 7 | |
| 8 | namespace WPDesk\FS\TableRate\ShippingMethod\Duplicate; |
| 9 | |
| 10 | use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable; |
| 11 | |
| 12 | /** |
| 13 | * Tracking of duplicate usages. |
| 14 | */ |
| 15 | class DuplicateTracker implements Hookable { |
| 16 | const PRIORITY_AFTER_FS_TRACKER = 12; |
| 17 | |
| 18 | /** |
| 19 | * Hooks. |
| 20 | */ |
| 21 | public function hooks() { |
| 22 | add_filter( 'wpdesk_tracker_data', [ $this, 'add_tracking_data' ], self::PRIORITY_AFTER_FS_TRACKER ); |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * @param array $data . |
| 27 | * |
| 28 | * @return array |
| 29 | */ |
| 30 | public function add_tracking_data( $data ): array { |
| 31 | $data['flexible_shipping']['duplicate'] = (int) get_option( DuplicateAction::OPTION, 0 ); |
| 32 | |
| 33 | return $data; |
| 34 | } |
| 35 | } |
| 36 |