Initial commit: Atomaste website
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Hostinger\EasyOnboarding\WooCommerce;
|
||||
|
||||
use WC_Payment_Gateways;
|
||||
use WC_Payment_Gateway;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class GatewayManager {
|
||||
public const STRIPE_DYNAMIC_GATEWAY_ID = 'cpsw_stripe_element';
|
||||
/**
|
||||
* @var WC_Payment_Gateways
|
||||
*/
|
||||
private WC_Payment_Gateways $payment_gateways;
|
||||
|
||||
/**
|
||||
* @param WC_Payment_Gateways $payment_gateways
|
||||
*/
|
||||
public function __construct( WC_Payment_Gateways $payment_gateways ) {
|
||||
$this->payment_gateways = $payment_gateways;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isAnyGatewayActive(): bool {
|
||||
$payment_gateways = $this->payment_gateways->payment_gateways();
|
||||
|
||||
if ( empty( $payment_gateways ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ( $payment_gateways as $gateway ) {
|
||||
// Does not have enabled property.
|
||||
if( $gateway->id === self::STRIPE_DYNAMIC_GATEWAY_ID ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isset( $gateway->settings['enabled'] ) && ( $gateway->settings['enabled'] === 'yes' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( $gateway->enabled === 'yes' ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Hostinger\EasyOnboarding\WooCommerce;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Options {
|
||||
/**
|
||||
* Hides Setup task list in WooCommerce
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function hideSetupTaskList(): void {
|
||||
$hidden_tasks = get_option( 'woocommerce_task_list_hidden_lists', false );
|
||||
|
||||
if($hidden_tasks === false) {
|
||||
update_option( 'woocommerce_task_list_hidden_lists', array( 'setup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables automatic creation of shipping zones
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disableWooCommerceShipingZoneCreation(): void {
|
||||
update_option( 'woocommerce_admin_created_default_shipping_zones', 'yes' );
|
||||
update_option( 'woocommerce_admin_reviewed_default_shipping_zones', 'yes' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Skips WooCommerce native onboarding
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function skipOnboarding(): void {
|
||||
$onboarding_profile = get_option( 'woocommerce_onboarding_profile', false );
|
||||
|
||||
if($onboarding_profile === false) {
|
||||
update_option( 'woocommerce_onboarding_profile', array( 'skipped' => true ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user