File "FlexibleShippingMethodsChecker.php"
Full Path: /home/jlklyejr/public_html/post-date/wp-content/plugins/flexible-shipping/src/WPDesk/FS/Helpers/FlexibleShippingMethodsChecker.php
File size: 785 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
/**
* Class FlexibleShippingMethodsChecker
*
* @package WPDesk\FS\Helpers
*/
namespace WPDesk\FS\Helpers;
use WPDesk\FS\TableRate\DefaultRulesSettings;
/**
* Checker for FS Methods.
*/
class FlexibleShippingMethodsChecker {
/**
* @return bool
*/
public function is_new_shipping_method(): bool {
$shipping_methods = flexible_shipping_get_all_shipping_methods();
if ( ! isset( $shipping_methods['flexible_shipping'] ) ) {
return false;
}
$flexible_shipping_rates = array_values( $shipping_methods['flexible_shipping']->get_all_rates() );
if ( empty( $flexible_shipping_rates ) || count( $flexible_shipping_rates ) > 1 ) {
return false;
}
return isset( $flexible_shipping_rates[0]['method_rules'][0][ DefaultRulesSettings::NEW_FIELD ] );
}
}