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

Update/cheque defaults #36

Merged
merged 2 commits into from
Aug 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ When creating a public release, do the following:
* Post your changelog notes in the description of the release.
* 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.
* Publish your release.

## Translation

For strings located in API endpoints, use `woocommerce` as your text-domain. These endpoints will at some point be merged back into WooCommerce Core.

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.
19 changes: 19 additions & 0 deletions hotfixes/wc-api-dev-cheque-defaults.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* Prevents the cheque/check payment method from being auto enabled if settings haven't been configured.
* It also sets the description/instructions defaults.
*
* @since 0.8.1
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

function wc_api_dev_cheque_defaults( $settings ) {
$settings['enabled']['default'] = 'no';
$settings['description']['default'] = __( 'Pay for this order by check.', 'wc-api-dev' );
$settings['instructions']['default'] = __( 'Make your check payable to...', 'wc-api-dev' );
return $settings;
}
add_filter( 'woocommerce_settings_api_form_fields_cheque', 'wc_api_dev_cheque_defaults' );
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ This section describes how to install the plugin and get it working.

== Changelog ==

= 0.8.1 =
* Fix - Don't auto enable the cheque payment method.
* Adds a new config constant (WC_API_DEV_ENABLE_HOTFIXES) to make it easy to disable hotfixes.

= 0.8.0 =
* Update orders endpoint to accept multiple statuses
* Fix - Email subject and footers becoming out of sync
Expand Down
1 change: 1 addition & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function load_wc() {
* Load WC API Dev.
*/
public function load_wc_api_dev() {
define( 'WC_API_DEV_ENABLE_HOTFIXES', false );
require_once( $this->plugin_dir . '/wc-api-dev.php' );
}

Expand Down
13 changes: 10 additions & 3 deletions wc-api-dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WooCommerce API Dev
* Plugin URI: https://woocommerce.com/
* Description: A feature plugin providing a bleeding edge version of the WooCommerce REST API.
* Version: 0.8.0
* Version: 0.8.1
* Author: Automattic
* Author URI: https://woocommerce.com
* Requires at least: 4.4
Expand All @@ -15,6 +15,10 @@
define( 'WC_API_DEV_AUTO_UPDATE', true );
}

if ( ! defined( 'WC_API_DEV_ENABLE_HOTFIXES' ) ){
define( 'WC_API_DEV_ENABLE_HOTFIXES', true );
}

if ( defined( 'WC_API_DEV_AUTO_UPDATE' ) && true === WC_API_DEV_AUTO_UPDATE ) {
include_once( plugin_dir_path( __FILE__ ) . 'auto-update.php' );
new WC_API_Dev_Updater;
Expand Down Expand Up @@ -119,8 +123,11 @@ public function includes() {
include_once( dirname( __FILE__ ) . '/api/class-wc-rest-dev-payment-gateways-controller.php' );

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

/**
Expand Down