Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.

Commit 90807fd

Browse files
author
Justin Shreve
authored
Update/cheque defaults (#36)
* Adds a hotfix that prevents the cheque/check payment method from being auto enabled * Add note about translation to README
1 parent a6c02b3 commit 90807fd

File tree

5 files changed

+40
-3
lines changed

5 files changed

+40
-3
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ When creating a public release, do the following:
2525
* Post your changelog notes in the description of the release.
2626
* Create & attach a binary containing a zip for the latest plugin version. The binary name should be `wc-api-dev.zip`. Please double check that the folder inside the archive is also called `wc-api-dev` and not something like `wc-api-dev-###hash` or `wc-api-dev-master`. You can create this binary by downloading a zip from GitHub, unzipping, and renaming the folder.
2727
* Publish your release.
28+
29+
## Translation
30+
31+
For strings located in API endpoints, use `woocommerce` as your text-domain. These endpoints will at some point be merged back into WooCommerce Core.
32+
33+
For other changes (such as the `hotfixes/` folder, which is being used to power an in-development interface for managing stores on WordPress.com) that are not to be merged into core, you can use `wc-api-dev` as your text-domain. These will most likely be split-out into a separate plugin soon.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
/**
3+
* Prevents the cheque/check payment method from being auto enabled if settings haven't been configured.
4+
* It also sets the description/instructions defaults.
5+
*
6+
* @since 0.8.1
7+
*/
8+
9+
if ( ! defined( 'ABSPATH' ) ) {
10+
exit;
11+
}
12+
13+
function wc_api_dev_cheque_defaults( $settings ) {
14+
$settings['enabled']['default'] = 'no';
15+
$settings['description']['default'] = __( 'Pay for this order by check.', 'wc-api-dev' );
16+
$settings['instructions']['default'] = __( 'Make your check payable to...', 'wc-api-dev' );
17+
return $settings;
18+
}
19+
add_filter( 'woocommerce_settings_api_form_fields_cheque', 'wc_api_dev_cheque_defaults' );

readme.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ This section describes how to install the plugin and get it working.
2525

2626
== Changelog ==
2727

28+
= 0.8.1 =
29+
* Fix - Don't auto enable the cheque payment method.
30+
* Adds a new config constant (WC_API_DEV_ENABLE_HOTFIXES) to make it easy to disable hotfixes.
31+
2832
= 0.8.0 =
2933
* Update orders endpoint to accept multiple statuses
3034
* Fix - Email subject and footers becoming out of sync

tests/bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public function load_wc() {
7070
* Load WC API Dev.
7171
*/
7272
public function load_wc_api_dev() {
73+
define( 'WC_API_DEV_ENABLE_HOTFIXES', false );
7374
require_once( $this->plugin_dir . '/wc-api-dev.php' );
7475
}
7576

wc-api-dev.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: WooCommerce API Dev
44
* Plugin URI: https://woocommerce.com/
55
* Description: A feature plugin providing a bleeding edge version of the WooCommerce REST API.
6-
* Version: 0.8.0
6+
* Version: 0.8.1
77
* Author: Automattic
88
* Author URI: https://woocommerce.com
99
* Requires at least: 4.4
@@ -15,6 +15,10 @@
1515
define( 'WC_API_DEV_AUTO_UPDATE', true );
1616
}
1717

18+
if ( ! defined( 'WC_API_DEV_ENABLE_HOTFIXES' ) ){
19+
define( 'WC_API_DEV_ENABLE_HOTFIXES', true );
20+
}
21+
1822
if ( defined( 'WC_API_DEV_AUTO_UPDATE' ) && true === WC_API_DEV_AUTO_UPDATE ) {
1923
include_once( plugin_dir_path( __FILE__ ) . 'auto-update.php' );
2024
new WC_API_Dev_Updater;
@@ -119,8 +123,11 @@ public function includes() {
119123
include_once( dirname( __FILE__ ) . '/api/class-wc-rest-dev-payment-gateways-controller.php' );
120124

121125
// Things that aren't related to a specific endpoint but to things like cross-plugin compatibility
122-
include_once( dirname( __FILE__ ) . '/hotfixes/wc-api-dev-jetpack-hotfixes.php' );
123-
include_once( dirname( __FILE__ ) . '/hotfixes/wc-api-dev-email-site-title.php' );
126+
if ( defined( 'WC_API_DEV_ENABLE_HOTFIXES' ) && true === WC_API_DEV_ENABLE_HOTFIXES ) {
127+
include_once( dirname( __FILE__ ) . '/hotfixes/wc-api-dev-jetpack-hotfixes.php' );
128+
include_once( dirname( __FILE__ ) . '/hotfixes/wc-api-dev-email-site-title.php' );
129+
include_once( dirname( __FILE__ ) . '/hotfixes/wc-api-dev-cheque-defaults.php' );
130+
}
124131
}
125132

126133
/**

0 commit comments

Comments
 (0)