Version Description
- Fix: PHP errors
Download this release
Release Info
| Developer | quadlayers |
| Plugin | |
| Version | 2.7.0 |
| Comparing to | |
| See all releases | |
Code changes from version 2.6.9 to 2.7.0
- includes/view/frontend/checkout.php +111 -119
- readme.txt +4 -1
- woocommerce-direct-checkout.php +2 -2
includes/view/frontend/checkout.php
CHANGED
|
@@ -1,155 +1,147 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
class QLWCDC_Checkout
|
| 4 |
-
{
|
| 5 |
|
| 6 |
-
protected static $instance;
|
| 7 |
|
| 8 |
-
|
| 9 |
-
{
|
| 10 |
-
add_filter('woocommerce_checkout_fields', array($this, 'remove_checkout_fields'));
|
| 11 |
|
| 12 |
-
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 21 |
-
add_filter('option_woocommerce_ship_to_destination', array($this, 'remove_checkout_shipping_address'), 10, 3);
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
}
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
}
|
| 31 |
-
}
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
return self::$instance;
|
| 39 |
-
}
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
|
|
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
|
|
|
| 77 |
|
| 78 |
-
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
|
| 84 |
-
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
|
| 93 |
-
|
| 94 |
|
| 95 |
-
|
| 96 |
-
|
| 97 |
|
| 98 |
-
|
| 99 |
-
|
| 100 |
|
| 101 |
-
|
| 102 |
|
| 103 |
-
|
| 104 |
|
| 105 |
-
|
| 106 |
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
if ('yes' === get_option('qlwcdc_remove_checkout_shipping_address')) {
|
| 148 |
-
$val = 'billing_only';
|
| 149 |
-
}
|
| 150 |
-
|
| 151 |
-
return $val;
|
| 152 |
-
}
|
| 153 |
}
|
| 154 |
|
| 155 |
QLWCDC_Checkout::instance();
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
class QLWCDC_Checkout {
|
|
|
|
| 4 |
|
|
|
|
| 5 |
|
| 6 |
+
protected static $instance;
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
public function __construct() {
|
| 9 |
+
add_filter( 'woocommerce_checkout_fields', array( $this, 'remove_checkout_fields' ) );
|
| 10 |
|
| 11 |
+
// add_filter('woocommerce_form_field_args', array($this, 'country_hidden_field_args'), 10, 4);
|
| 12 |
|
| 13 |
+
// add_filter('woocommerce_form_field_country_hidden', array($this, 'country_hidden_field'), 10, 4);
|
| 14 |
|
| 15 |
+
add_filter( 'woocommerce_countries_allowed_countries', array( $this, 'remove_allowed_countries' ) );
|
| 16 |
|
| 17 |
+
add_action( 'woocommerce_before_checkout_form', array( $this, 'remove_country_css' ) );
|
|
|
|
| 18 |
|
| 19 |
+
add_filter( 'woocommerce_enable_order_notes_field', array( $this, 'remove_checkout_order_commens' ) );
|
| 20 |
+
add_filter( 'option_woocommerce_ship_to_destination', array( $this, 'remove_checkout_shipping_address' ), 10, 3 );
|
|
|
|
| 21 |
|
| 22 |
+
if ( 'yes' === get_option( 'qlwcdc_remove_checkout_privacy_policy_text' ) ) {
|
| 23 |
+
remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_checkout_privacy_policy_text', 20 );
|
| 24 |
+
}
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
if ( 'yes' === get_option( 'qlwcdc_remove_checkout_terms_and_conditions' ) ) {
|
| 27 |
+
add_filter( 'woocommerce_checkout_show_terms', '__return_false' );
|
| 28 |
+
remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_terms_and_conditions_page_content', 30 );
|
| 29 |
+
}
|
| 30 |
+
}
|
|
|
|
|
|
|
| 31 |
|
| 32 |
+
public static function instance() {
|
| 33 |
+
if ( ! isset( self::$instance ) ) {
|
| 34 |
+
self::$instance = new self();
|
| 35 |
+
}
|
| 36 |
+
return self::$instance;
|
| 37 |
+
}
|
| 38 |
|
| 39 |
+
function remove_checkout_fields( $fields ) {
|
| 40 |
+
if ( $remove = get_option( 'qlwcdc_remove_checkout_fields', array() ) ) {
|
| 41 |
|
| 42 |
+
foreach ( $remove as $id => $key ) {
|
| 43 |
+
// We need to remove both fields otherwise will be required
|
| 44 |
+
if ( $key == 'country' ) {
|
| 45 |
+
continue;
|
| 46 |
+
}
|
| 47 |
+
unset( $fields['billing'][ 'billing_' . $key ] );
|
| 48 |
+
unset( $fields['shipping'][ 'shipping_' . $key ] );
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
|
| 52 |
+
return $fields;
|
| 53 |
+
}
|
| 54 |
|
| 55 |
+
/*
|
| 56 |
+
function country_hidden_field_args($args, $key, $value = null)
|
| 57 |
+
{
|
| 58 |
|
| 59 |
+
$remove = get_option('qlwcdc_remove_checkout_fields', array());
|
| 60 |
|
| 61 |
+
if (in_array('country', (array) $remove)) {
|
| 62 |
+
if ($key == 'billing_country' || $key == 'shipping') {
|
| 63 |
+
$args['default'] = 'AR';
|
| 64 |
+
$args['required'] = false;
|
| 65 |
+
$args['type'] = 'country_hidden';
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
|
| 69 |
+
return $args;
|
| 70 |
+
}*/
|
| 71 |
|
| 72 |
+
/*
|
| 73 |
+
function country_hidden_field($field = '', $key, $args, $value)
|
| 74 |
+
{
|
| 75 |
|
| 76 |
+
static $instance = 0;
|
| 77 |
|
| 78 |
+
if ($instance) {
|
| 79 |
+
return $field;
|
| 80 |
+
}
|
| 81 |
|
| 82 |
+
$instance++;
|
| 83 |
|
| 84 |
+
$value = WC()->countries->get_base_country();
|
| 85 |
+
//$countries = WC()->countries->get_allowed_countries();
|
| 86 |
|
| 87 |
+
//if (count($countries = WC()->countries->get_allowed_countries())) {
|
| 88 |
+
// $value = key($countries);
|
| 89 |
+
//}
|
| 90 |
|
| 91 |
+
$field .= '<input type="text" class="country_to_state" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" value="' . esc_html($value) . '" ' . implode(' ', $args['custom_attributes']) . ' readonly="readonly" />';
|
| 92 |
|
| 93 |
+
return $field;
|
| 94 |
+
} */
|
| 95 |
|
| 96 |
+
function remove_allowed_countries( $countries ) {
|
| 97 |
+
$remove = get_option( 'qlwcdc_remove_checkout_fields', array() );
|
| 98 |
|
| 99 |
+
if ( in_array( 'country', (array) $remove ) ) {
|
| 100 |
|
| 101 |
+
if ( isset( WC()->countries ) && method_exists( WC()->countries, 'get_base_country' ) ) {
|
| 102 |
|
| 103 |
+
$base = WC()->countries->get_base_country();
|
| 104 |
|
| 105 |
+
if ( isset( $countries[ $base ] ) ) {
|
| 106 |
+
|
| 107 |
+
$countries = array(
|
| 108 |
+
$base => $countries[ $base ],
|
| 109 |
+
);
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
return $countries;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
public function remove_country_css() {
|
| 118 |
+
$remove = get_option( 'qlwcdc_remove_checkout_fields', array() );
|
| 119 |
+
if ( in_array( 'country', (array) $remove ) ) {
|
| 120 |
+
?>
|
| 121 |
+
<style>
|
| 122 |
+
#billing_country_field {
|
| 123 |
+
display: none !important;
|
| 124 |
+
}
|
| 125 |
+
</style>
|
| 126 |
+
<?php
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
function remove_checkout_order_commens( $return ) {
|
| 131 |
+
if ( 'yes' === get_option( 'qlwcdc_remove_checkout_order_comments' ) ) {
|
| 132 |
+
$return = false;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
return $return;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
function remove_checkout_shipping_address( $val ) {
|
| 139 |
+
if ( 'yes' === get_option( 'qlwcdc_remove_checkout_shipping_address' ) ) {
|
| 140 |
+
$val = 'billing_only';
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
return $val;
|
| 144 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
}
|
| 146 |
|
| 147 |
QLWCDC_Checkout::instance();
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/portfolio/woocommerce-direct-checkout/
|
|
| 4 |
Tags: woocommerce, woocommerce ajax, woocommerce ajax cart, add to cart, woocommerce direct checkout, woocommerce quick buy, woocommerce remove checkout fields, woocommerce ajax single products, woocommerce one page checkout
|
| 5 |
Requires at least: 4.6
|
| 6 |
Tested up to: 6.0
|
| 7 |
-
Stable tag: 2.
|
| 8 |
WC requires at least: 3.1.0
|
| 9 |
WC tested up to: 6.9
|
| 10 |
License: GPLv3
|
|
@@ -64,6 +64,9 @@ The premium version of WooCommerce Direct Checkot allows to include a quick purc
|
|
| 64 |
|
| 65 |
== Changelog ==
|
| 66 |
|
|
|
|
|
|
|
|
|
|
| 67 |
= 2.6.9 =
|
| 68 |
* Fix: WooCommerce compatibility
|
| 69 |
|
| 4 |
Tags: woocommerce, woocommerce ajax, woocommerce ajax cart, add to cart, woocommerce direct checkout, woocommerce quick buy, woocommerce remove checkout fields, woocommerce ajax single products, woocommerce one page checkout
|
| 5 |
Requires at least: 4.6
|
| 6 |
Tested up to: 6.0
|
| 7 |
+
Stable tag: 2.7.0
|
| 8 |
WC requires at least: 3.1.0
|
| 9 |
WC tested up to: 6.9
|
| 10 |
License: GPLv3
|
| 64 |
|
| 65 |
== Changelog ==
|
| 66 |
|
| 67 |
+
= 2.7.0 =
|
| 68 |
+
* Fix: PHP errors
|
| 69 |
+
|
| 70 |
= 2.6.9 =
|
| 71 |
* Fix: WooCommerce compatibility
|
| 72 |
|
woocommerce-direct-checkout.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
* Plugin Name: Direct Checkout for WooCommerce
|
| 5 |
* Plugin URI: https://quadlayers.com/documentation/woocommerce-direct-checkout/
|
| 6 |
* Description: Simplifies the checkout process to improve your sales rate.
|
| 7 |
-
* Version: 2.
|
| 8 |
* Author: QuadLayers
|
| 9 |
* Author URI: https://quadlayers.com
|
| 10 |
* License: GPLv3
|
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
| 17 |
}
|
| 18 |
|
| 19 |
define( 'QLWCDC_PLUGIN_NAME', 'Direct Checkout for WooCommerce' );
|
| 20 |
-
define( 'QLWCDC_PLUGIN_VERSION', '2.
|
| 21 |
define( 'QLWCDC_PLUGIN_FILE', __FILE__ );
|
| 22 |
define( 'QLWCDC_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR );
|
| 23 |
define( 'QLWCDC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
| 4 |
* Plugin Name: Direct Checkout for WooCommerce
|
| 5 |
* Plugin URI: https://quadlayers.com/documentation/woocommerce-direct-checkout/
|
| 6 |
* Description: Simplifies the checkout process to improve your sales rate.
|
| 7 |
+
* Version: 2.7.0
|
| 8 |
* Author: QuadLayers
|
| 9 |
* Author URI: https://quadlayers.com
|
| 10 |
* License: GPLv3
|
| 17 |
}
|
| 18 |
|
| 19 |
define( 'QLWCDC_PLUGIN_NAME', 'Direct Checkout for WooCommerce' );
|
| 20 |
+
define( 'QLWCDC_PLUGIN_VERSION', '2.7.0' );
|
| 21 |
define( 'QLWCDC_PLUGIN_FILE', __FILE__ );
|
| 22 |
define( 'QLWCDC_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR );
|
| 23 |
define( 'QLWCDC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
