abstracts
3 months ago
admin
3 months ago
frontend
1 month ago
integrations
1 month ago
v3
3 months ago
vendor
6 days ago
views
8 months ago
class-simplesalestax.php
6 days ago
class-sst-addresses.php
1 month ago
class-sst-ajax.php
3 months ago
class-sst-assets.php
6 months ago
class-sst-blocks-integration.php
1 month ago
class-sst-blocks.php
1 year ago
class-sst-certificates.php
6 days ago
class-sst-install.php
6 months ago
class-sst-logger.php
5 months ago
class-sst-marketplaces.php
6 months ago
class-sst-order-controller.php
3 months ago
class-sst-order.php
1 month ago
class-sst-origin-address.php
8 months ago
class-sst-product.php
3 months ago
class-sst-rate-limit.php
5 months ago
class-sst-settings.php
3 months ago
class-sst-shipping.php
3 years ago
class-sst-taxcloud-v3-api.php
3 months ago
class-sst-taxcloud-v3.php
3 months ago
class-sst-tic.php
2 years ago
class-sst-updater.php
3 years ago
sst-compatibility-functions.php
4 months ago
sst-functions.php
6 days ago
sst-message-functions.php
3 years ago
sst-update-functions.php
11 months ago
class-sst-taxcloud-v3.php
77 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | /** |
| 8 | * TaxCloud v3 Client. |
| 9 | * |
| 10 | * Handles the data v3 settings. |
| 11 | * |
| 12 | * @author Simple Sales Tax |
| 13 | * @package SST |
| 14 | * @since 8.4.1 |
| 15 | */ |
| 16 | class SST_TaxCloud_V3 { |
| 17 | |
| 18 | /** |
| 19 | * Singleton instance. |
| 20 | * |
| 21 | * @var SST_TaxCloud_V3 |
| 22 | * @since 8.4.1 |
| 23 | */ |
| 24 | protected static $_instance = null; |
| 25 | |
| 26 | /** |
| 27 | * Singleton instance accessor. |
| 28 | * |
| 29 | * @return SST_TaxCloud_V3 Singleton instance. |
| 30 | * @since 8.4.1 |
| 31 | */ |
| 32 | public static function instance() { |
| 33 | if ( is_null( self::$_instance ) ) { |
| 34 | self::$_instance = new self(); |
| 35 | } |
| 36 | |
| 37 | return self::$_instance; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Constructor. |
| 42 | * |
| 43 | * @since 8.4.1 |
| 44 | */ |
| 45 | protected function __construct() { |
| 46 | add_action( 'sst_update_data_mover_settings', array( 'SST_TaxCloud_V3_API', 'update_data_mover_settings' ) ); |
| 47 | add_filter( 'sst_get_option', array( $this, 'update_show_tax_option' ), 10, 2 ); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Update the show_zero_tax option if disable_integration is true. |
| 52 | * |
| 53 | * @param string $value Value of the option. |
| 54 | * @param string $key Key of the option. |
| 55 | * |
| 56 | * @return string Updated value. |
| 57 | * @since 8.4.1 |
| 58 | */ |
| 59 | public function update_show_tax_option( $value, $key ) { |
| 60 | if ( 'show_zero_tax' === $key ) { |
| 61 | $disable_integration = SST_Settings::get( 'disable_integration', 'no' ); |
| 62 | if( 'yes' === $disable_integration ) { |
| 63 | return 'no'; |
| 64 | } |
| 65 | } elseif ( 'order_show_zero_tax' === $key ) { |
| 66 | $disable_integration = SST_Settings::get( 'disable_integration', 'no' ); |
| 67 | if( 'yes' === $disable_integration ) { |
| 68 | return 'no'; |
| 69 | } |
| 70 | } |
| 71 | return $value; |
| 72 | } |
| 73 | |
| 74 | } |
| 75 | |
| 76 | // Initialize the instance. |
| 77 | SST_TaxCloud_V3::instance(); |