add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_country']); //удаляем! тут хранится значение страны оплаты
unset($fields['shipping']['shipping_country']); ////удаляем! тут хранится значение страны доставки
return $fields;
}
interface DeliveryInterface
{
public const TYPE_COURIER = 1;
public const TYPE_PICKUP_POINT = 2;
public const TYPE_ALL = self::TYPE_COURIER + self::TYPE_PICKUP_POINT;
public function getId(): int;
public function getName(): string;
public function getType(): int;
public function getPaymentTypes(): array;
public function isAllowedAddress(Address $address): bool;
public function calculateCost(Address $from, Address $to): array;
}
interface PickupDeliveryInterface extends DeliveryInterface
{
public function getPickupPoints(Address $address = null): array;
}
class DeliveryManager
{
private $deliveries = [];
public function registerDelivery(DeliveryInterface $delivery)
{
$this->deliveries[$delivery->getId()] = $delivery;
}
public function registerDeliveryClass(int $id, string $className, array $config = [])
{
$this->deliveries[$id] = [$className, ['id' => $id] + $config];
}
public function getDelivery(int $id): DeliveryInterface
{
if (!isset($this->deliveries[$id])) {
throw new InvalidArgumentException();
}
if (is_array($this->deliveries[$id])) {
[$className, $config] = $this->deliveries[$id];
$this->deliveries[$id] = new $className($config);
}
return $this->deliveries[$id];
}
}
const [users, setUsers] = useState({user:['user1', 'user2', 'user3']});
setUsers(users.user.filter((item,i) => i !== index));
const list = users.user.map(...