WooCommerce Direct Checkout - Version 1.0.9

Version Description

Download this release

Release Info

Developer terrytsang
Plugin Icon 128x128 WooCommerce Direct Checkout
Version 1.0.9
Comparing to
See all releases

Code changes from version 1.0.7 to 1.0.9

.project ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>woocommerce-direct-checkout</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ </buildSpec>
9
+ <natures>
10
+ </natures>
11
+ </projectDescription>
readme.txt CHANGED
@@ -5,9 +5,9 @@ Plugin Name: WooCommerce Custom Direct Checkout
5
  Plugin URI: http://terrytsang.com/shop/shop/woocommerce-direct-checkout/
6
  Tags: woocommerce, custom fields, direct, checkout, e-commerce
7
  Requires at least: 2.7
8
- Tested up to: 3.9.1
9
- Stable tag: 1.0.7
10
- Version: 1.0.7
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -20,6 +20,7 @@ A WooCommerce plugin that aims to simplify the checkout process, leading to an i
20
  In WooCommerce Settings Panel, there will be a new submenu link called 'Direct Checkout' where you can:
21
 
22
  * Enabled / Disabled the direct checkout option
 
23
  * Change "Add to cart" to any text (Option to exclude external product)
24
  * Update "Redirect to Page" option
25
 
@@ -33,9 +34,13 @@ In WooCommerce Settings Panel, there will be a new submenu link called 'Direct C
33
  * Please uncheck the option "Enable AJAX add to cart buttons on archives" at WooCommerce > Settings > Catalog to make the rediection working without ajax.
34
 
35
  = GET PRO VERSION =
36
- http://terrytsang.com/shop/shop/woocommerce-direct-checkout-pro/
37
 
38
- = Additional Plugins by Terry Tsang =
 
 
 
 
39
  * [Custom Checkout Options] (http://terrytsang.com/shop/shop/woocommerce-custom-checkout-options/)
40
  * [Social Buttons PRO] (http://terrytsang.com/shop/shop/woocommerce-social-buttons-pro/)
41
  * [Extra Fee Options PRO] (http://terrytsang.com/shop/shop/woocommerce-extra-fee-option-pro/)
@@ -56,6 +61,11 @@ http://terrytsang.com/shop/shop/woocommerce-direct-checkout-pro/
56
 
57
  == Changelog ==
58
 
 
 
 
 
 
59
  = 1.0.7 =
60
 
61
  * Updated PRO version download link
5
  Plugin URI: http://terrytsang.com/shop/shop/woocommerce-direct-checkout/
6
  Tags: woocommerce, custom fields, direct, checkout, e-commerce
7
  Requires at least: 2.7
8
+ Tested up to: 4.0
9
+ Stable tag: 1.0.9
10
+ Version: 1.0.9
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
20
  In WooCommerce Settings Panel, there will be a new submenu link called 'Direct Checkout' where you can:
21
 
22
  * Enabled / Disabled the direct checkout option
23
+ * Add "Continue Shopping" button to product page
24
  * Change "Add to cart" to any text (Option to exclude external product)
25
  * Update "Redirect to Page" option
26
 
34
  * Please uncheck the option "Enable AJAX add to cart buttons on archives" at WooCommerce > Settings > Catalog to make the rediection working without ajax.
35
 
36
  = GET PRO VERSION =
37
+ [WooCommerce Direct Checkout PRO](http://terrytsang.com/shop/shop/woocommerce-direct-checkout-pro/)
38
 
39
+ * Added Additional Button Options (beside Add to Cart button)
40
+ * Per Product Basis Settings
41
+ * more features…
42
+
43
+ = Popular Plugins by Terry Tsang =
44
  * [Custom Checkout Options] (http://terrytsang.com/shop/shop/woocommerce-custom-checkout-options/)
45
  * [Social Buttons PRO] (http://terrytsang.com/shop/shop/woocommerce-social-buttons-pro/)
46
  * [Extra Fee Options PRO] (http://terrytsang.com/shop/shop/woocommerce-extra-fee-option-pro/)
61
 
62
  == Changelog ==
63
 
64
+ = 1.0.8 =
65
+
66
+ * Add Continue Shopping button at product page
67
+ * Fixed missing variable warning
68
+
69
  = 1.0.7 =
70
 
71
  * Updated PRO version download link
screenshot-1.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
wc-direct-checkout.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WooCommerce Direct Checkout
4
  Plugin URI: http://terrytsang.com/shop/shop/woocommerce-direct-checkout/
5
  Description: Allow you to implement direct checkout (skip cart page) for WooCommerce
6
- Version: 1.0.7
7
  Author: Terry Tsang
8
  Author URI: http://shop.terrytsang.com
9
  */
@@ -29,7 +29,7 @@ Author URI: http://shop.terrytsang.com
29
  define('wc_plugin_name_direct_checkout', 'WooCommerce Direct Checkout');
30
 
31
  // Define plugin version
32
- define('wc_version_direct_checkout', '1.0.7');
33
 
34
 
35
  // Checks if the WooCommerce plugins is installed and active.
@@ -60,7 +60,8 @@ if(in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_o
60
  'direct_checkout_enabled' => '',
61
  'direct_checkout_cart_button_text' => '',
62
  'direct_checkout_exclude_external' => '',
63
- 'direct_checkout_cart_redirect_url' => ''
 
64
  );
65
 
66
  $this->saved_options_direct_checkout = array();
@@ -82,12 +83,17 @@ if(in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_o
82
  update_option('woocommerce_cart_redirect_after_add', 'no');
83
  update_option('woocommerce_enable_ajax_add_to_cart', 'no');
84
 
85
- add_filter('add_to_cart_redirect', array( &$this, 'custom_add_to_cart_redirect') );
86
  add_filter('single_add_to_cart_text', array( &$this, 'custom_cart_button_text') );
87
  add_filter('add_to_cart_text', array( &$this, 'custom_cart_button_text') );
88
 
89
  add_filter('woocommerce_product_single_add_to_cart_text', array( &$this, 'custom_cart_button_text') );
90
  add_filter('woocommerce_product_add_to_cart_text', array( &$this, 'custom_cart_button_text') );
 
 
 
 
 
 
91
  }
92
  }
93
 
@@ -102,6 +108,31 @@ if(in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_o
102
  else
103
  return get_permalink(get_option('woocommerce_checkout_page_id'));
104
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
  /**
107
  * Set custom add to cart text
@@ -156,6 +187,7 @@ if(in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_o
156
  check_admin_referer( $this->textdomain );
157
 
158
  $this->saved_options_direct_checkout['direct_checkout_enabled'] = ! isset( $_POST['direct_checkout_enabled'] ) ? '1' : $_POST['direct_checkout_enabled'];
 
159
  $this->saved_options_direct_checkout['direct_checkout_cart_button_text'] = ! isset( $_POST['direct_checkout_cart_button_text'] ) ? 'Add to cart' : $_POST['direct_checkout_cart_button_text'];
160
  $this->saved_options_direct_checkout['direct_checkout_exclude_external'] = ! isset( $_POST['direct_checkout_exclude_external'] ) ? '1' : $_POST['direct_checkout_exclude_external'];
161
  $this->saved_options_direct_checkout['direct_checkout_cart_redirect_url'] = ! isset( $_POST['direct_checkout_cart_redirect_url'] ) ? '' : $_POST['direct_checkout_cart_redirect_url'];
@@ -173,17 +205,23 @@ if(in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_o
173
  }
174
 
175
  $direct_checkout_enabled = get_option( 'direct_checkout_enabled' );
 
176
  $direct_checkout_cart_button_text = get_option( 'direct_checkout_cart_button_text' ) ? get_option( 'direct_checkout_cart_button_text' ) : 'Add to Cart';
177
  $direct_checkout_exclude_external = get_option( 'direct_checkout_exclude_external' );
178
  $direct_checkout_cart_redirect_url = get_option( 'direct_checkout_cart_redirect_url' );
179
 
180
  $checked_enabled = '';
 
 
181
 
182
  if($direct_checkout_enabled)
183
  $checked_enabled = 'checked="checked"';
184
 
185
  if($direct_checkout_exclude_external)
186
  $checked_enabled_exclude = 'checked="checked"';
 
 
 
187
 
188
  $actionurl = $_SERVER['REQUEST_URI'];
189
  $nonce = wp_create_nonce( $this->textdomain );
@@ -207,16 +245,23 @@ if(in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_o
207
  <tbody>
208
  <tr>
209
  <td colspan="2">
210
- <table class="widefat fixed" cellspacing="2" cellpadding="5" border="0">
211
  <tr>
212
- <td width="25%"><?php _e( 'Enable', $this->textdomain ); ?></td>
213
  <td>
214
  <input class="checkbox" name="direct_checkout_enabled" id="direct_checkout_enabled" value="0" type="hidden">
215
- <input class="checkbox" name="direct_checkout_enabled" id="direct_checkout_enabled" value="1" type="checkbox" <?php echo $checked_enabled; ?> type="checkbox">
 
 
 
 
 
 
 
216
  </td>
217
  </tr>
218
  <tr>
219
- <td width="25%"><?php _e( 'Custom Add to Cart Text', $this->textdomain ); ?></td>
220
  <td>
221
  <input name="direct_checkout_cart_button_text" id="direct_checkout_cart_button_text" value="<?php echo $direct_checkout_cart_button_text; ?>" />
222
  <input class="checkbox" name="direct_checkout_exclude_external" id="direct_checkout_exclude_external" value="0" type="hidden">
@@ -224,7 +269,7 @@ if(in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_o
224
  </td>
225
  </tr>
226
  <tr>
227
- <td width="25%"><?php _e( 'Redirect to Page', $this->textdomain ); ?><br /><span style="color:#ccc;"><?php _e( '(Default will be checkout page if not set)', $this->textdomain ); ?></span></td>
228
  <td>
229
  <select name="direct_checkout_cart_redirect_url">
230
  <option value=""><?php echo esc_attr( __( 'Select page' ) ); ?></option>
3
  Plugin Name: WooCommerce Direct Checkout
4
  Plugin URI: http://terrytsang.com/shop/shop/woocommerce-direct-checkout/
5
  Description: Allow you to implement direct checkout (skip cart page) for WooCommerce
6
+ Version: 1.0.9
7
  Author: Terry Tsang
8
  Author URI: http://shop.terrytsang.com
9
  */
29
  define('wc_plugin_name_direct_checkout', 'WooCommerce Direct Checkout');
30
 
31
  // Define plugin version
32
+ define('wc_version_direct_checkout', '1.0.9');
33
 
34
 
35
  // Checks if the WooCommerce plugins is installed and active.
60
  'direct_checkout_enabled' => '',
61
  'direct_checkout_cart_button_text' => '',
62
  'direct_checkout_exclude_external' => '',
63
+ 'direct_checkout_cart_redirect_url' => '',
64
+ 'direct_checkout_continue_enabled' => ''
65
  );
66
 
67
  $this->saved_options_direct_checkout = array();
83
  update_option('woocommerce_cart_redirect_after_add', 'no');
84
  update_option('woocommerce_enable_ajax_add_to_cart', 'no');
85
 
 
86
  add_filter('single_add_to_cart_text', array( &$this, 'custom_cart_button_text') );
87
  add_filter('add_to_cart_text', array( &$this, 'custom_cart_button_text') );
88
 
89
  add_filter('woocommerce_product_single_add_to_cart_text', array( &$this, 'custom_cart_button_text') );
90
  add_filter('woocommerce_product_add_to_cart_text', array( &$this, 'custom_cart_button_text') );
91
+
92
+ add_filter('add_to_cart_redirect', array( &$this, 'custom_add_to_cart_redirect') );
93
+
94
+ if(get_option('direct_checkout_continue_enabled'))
95
+ add_action( 'woocommerce_after_add_to_cart_button', array( &$this, 'direct_checkout_continue_button') );
96
+
97
  }
98
  }
99
 
108
  else
109
  return get_permalink(get_option('woocommerce_checkout_page_id'));
110
  }
111
+
112
+ /**
113
+ * Set continue shopping button for single product
114
+ */
115
+ function direct_checkout_continue_button() {
116
+ global $woocommerce, $post, $product;
117
+ global $wp_query;
118
+
119
+ $postID = $wp_query->post->ID;
120
+
121
+ $direct_checkout_continue_enabled = get_option( 'direct_checkout_continue_enabled' );
122
+ $single_product_title = strip_tags($post->post_title);
123
+
124
+ if($direct_checkout_continue_enabled == "1"){
125
+ $additional_button_text = __( 'Continue Shopping', $this->textdomain );
126
+ $additional_button_url = get_permalink(get_option('woocommerce_shop_page_id'));
127
+ }
128
+
129
+ $target_blank = $direct_checkout_continue_enabled ? '' : ' target="_blank"';
130
+
131
+ if( $direct_checkout_continue_enabled ){
132
+ $html_button = '<a href="'.$additional_button_url.'" title="'.$single_product_title.'" class="button alt"'.$target_blank.'>'.$additional_button_text.'</a>';
133
+ echo $html_button;
134
+ }
135
+ }
136
 
137
  /**
138
  * Set custom add to cart text
187
  check_admin_referer( $this->textdomain );
188
 
189
  $this->saved_options_direct_checkout['direct_checkout_enabled'] = ! isset( $_POST['direct_checkout_enabled'] ) ? '1' : $_POST['direct_checkout_enabled'];
190
+ $this->saved_options_direct_checkout['direct_checkout_continue_enabled'] = ! isset( $_POST['direct_checkout_continue_enabled'] ) ? '1' : $_POST['direct_checkout_continue_enabled'];
191
  $this->saved_options_direct_checkout['direct_checkout_cart_button_text'] = ! isset( $_POST['direct_checkout_cart_button_text'] ) ? 'Add to cart' : $_POST['direct_checkout_cart_button_text'];
192
  $this->saved_options_direct_checkout['direct_checkout_exclude_external'] = ! isset( $_POST['direct_checkout_exclude_external'] ) ? '1' : $_POST['direct_checkout_exclude_external'];
193
  $this->saved_options_direct_checkout['direct_checkout_cart_redirect_url'] = ! isset( $_POST['direct_checkout_cart_redirect_url'] ) ? '' : $_POST['direct_checkout_cart_redirect_url'];
205
  }
206
 
207
  $direct_checkout_enabled = get_option( 'direct_checkout_enabled' );
208
+ $direct_checkout_continue_enabled = get_option( 'direct_checkout_continue_enabled' );
209
  $direct_checkout_cart_button_text = get_option( 'direct_checkout_cart_button_text' ) ? get_option( 'direct_checkout_cart_button_text' ) : 'Add to Cart';
210
  $direct_checkout_exclude_external = get_option( 'direct_checkout_exclude_external' );
211
  $direct_checkout_cart_redirect_url = get_option( 'direct_checkout_cart_redirect_url' );
212
 
213
  $checked_enabled = '';
214
+ $checked_enabled_exclude = '';
215
+ $checked_continue_enabled = '';
216
 
217
  if($direct_checkout_enabled)
218
  $checked_enabled = 'checked="checked"';
219
 
220
  if($direct_checkout_exclude_external)
221
  $checked_enabled_exclude = 'checked="checked"';
222
+
223
+ if($direct_checkout_continue_enabled)
224
+ $checked_continue_enabled = 'checked="checked"';
225
 
226
  $actionurl = $_SERVER['REQUEST_URI'];
227
  $nonce = wp_create_nonce( $this->textdomain );
245
  <tbody>
246
  <tr>
247
  <td colspan="2">
248
+ <table class="widefat auto" cellspacing="2" cellpadding="5" border="0">
249
  <tr>
250
+ <td width="30%"><?php _e( 'Enable', $this->textdomain ); ?></td>
251
  <td>
252
  <input class="checkbox" name="direct_checkout_enabled" id="direct_checkout_enabled" value="0" type="hidden">
253
+ <input class="checkbox" name="direct_checkout_enabled" id="direct_checkout_enabled" value="1" type="checkbox" <?php echo $checked_enabled; ?>>
254
+ </td>
255
+ </tr>
256
+ <tr>
257
+ <td width="30%"><?php _e( 'Add Continue Shopping Button', $this->textdomain ); ?></td>
258
+ <td>
259
+ <input class="checkbox" name="direct_checkout_continue_enabled" id="direct_checkout_continue_enabled" value="0" type="hidden">
260
+ <input class="checkbox" name="direct_checkout_continue_enabled" id="direct_checkout_continue_enabled" value="1" type="checkbox" <?php echo $checked_continue_enabled; ?>>
261
  </td>
262
  </tr>
263
  <tr>
264
+ <td width="30%"><?php _e( 'Custom Add to Cart Text', $this->textdomain ); ?></td>
265
  <td>
266
  <input name="direct_checkout_cart_button_text" id="direct_checkout_cart_button_text" value="<?php echo $direct_checkout_cart_button_text; ?>" />
267
  <input class="checkbox" name="direct_checkout_exclude_external" id="direct_checkout_exclude_external" value="0" type="hidden">
269
  </td>
270
  </tr>
271
  <tr>
272
+ <td width="30%"><?php _e( 'Redirect to Page', $this->textdomain ); ?><br /><span style="color:#ccc;"><?php _e( '(Default will be checkout page if not set)', $this->textdomain ); ?></span></td>
273
  <td>
274
  <select name="direct_checkout_cart_redirect_url">
275
  <option value=""><?php echo esc_attr( __( 'Select page' ) ); ?></option>
wc-direct-checkout.pot CHANGED
@@ -1,9 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: WooCommerce Direct Checkout v1.0.0\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
- "PO-Revision-Date: 2013-07-10 15:54:14+0000\n"
7
  "Last-Translator: admin <terrytsang811@gmail.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
@@ -19,33 +19,58 @@ msgstr ""
19
  "X-Poedit-SearchPath-0: .\n"
20
  "X-Textdomain-Support: yes"
21
 
22
- #: wc-direct-checkout.php:113
23
  #@ wc-direct-checkout
24
  msgid "Direct Checkout"
25
  msgstr ""
26
 
27
- #: wc-direct-checkout.php:141
28
  #@ wc-direct-checkout
29
  msgid "You have saved WooCommerce Direct Checkout options."
30
  msgstr ""
31
 
32
- #: wc-direct-checkout.php:161
33
  #@ wc-direct-checkout
34
  msgid "Direct Checkout Options"
35
  msgstr ""
36
 
37
- #: wc-direct-checkout.php:177
38
  #@ wc-direct-checkout
39
  msgid "Enable"
40
  msgstr ""
41
 
42
- #: wc-direct-checkout.php:184
43
  #@ wc-direct-checkout
44
  msgid "Custom Add to Cart Text"
45
  msgstr ""
46
 
47
- #: wc-direct-checkout.php:194
48
  #@ wc-direct-checkout
49
  msgid "Save Options"
50
  msgstr ""
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: WooCommerce Direct Checkout v1.0.8\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2014-07-07 17:40:21+0000\n"
7
  "Last-Translator: admin <terrytsang811@gmail.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
  "X-Textdomain-Support: yes"
21
 
22
+ #: wc-direct-checkout.php:173
23
  #@ wc-direct-checkout
24
  msgid "Direct Checkout"
25
  msgstr ""
26
 
27
+ #: wc-direct-checkout.php:204
28
  #@ wc-direct-checkout
29
  msgid "You have saved WooCommerce Direct Checkout options."
30
  msgstr ""
31
 
32
+ #: wc-direct-checkout.php:234
33
  #@ wc-direct-checkout
34
  msgid "Direct Checkout Options"
35
  msgstr ""
36
 
37
+ #: wc-direct-checkout.php:250
38
  #@ wc-direct-checkout
39
  msgid "Enable"
40
  msgstr ""
41
 
42
+ #: wc-direct-checkout.php:264
43
  #@ wc-direct-checkout
44
  msgid "Custom Add to Cart Text"
45
  msgstr ""
46
 
47
+ #: wc-direct-checkout.php:296
48
  #@ wc-direct-checkout
49
  msgid "Save Options"
50
  msgstr ""
51
 
52
+ #: wc-direct-checkout.php:125
53
+ #@ wc-direct-checkout
54
+ msgid "Continue Shopping"
55
+ msgstr ""
56
+
57
+ #: wc-direct-checkout.php:257
58
+ #@ wc-direct-checkout
59
+ msgid "Add Continue Shopping Button"
60
+ msgstr ""
61
+
62
+ #: wc-direct-checkout.php:272
63
+ #@ wc-direct-checkout
64
+ msgid "Redirect to Page"
65
+ msgstr ""
66
+
67
+ #: wc-direct-checkout.php:272
68
+ #@ wc-direct-checkout
69
+ msgid "(Default will be checkout page if not set)"
70
+ msgstr ""
71
+
72
+ #: wc-direct-checkout.php:275
73
+ #@ default
74
+ msgid "Select page"
75
+ msgstr ""
76
+