Version Description
Download this release
Release Info
Developer | ferdev |
Plugin | WooCommerce Square |
Version | 1.0.36 |
Comparing to | |
See all releases |
Code changes from version 1.0.35 to 1.0.36
changelog.txt
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
*** WooCommerce Square Changelog ***
|
2 |
|
|
|
|
|
|
|
3 |
= 1.0.35 - 2019-02-01 =
|
4 |
* Fix - Idempotency key reuse issue when checking out.
|
5 |
|
1 |
*** WooCommerce Square Changelog ***
|
2 |
|
3 |
+
= 1.0.36 - 2019-04-15 =
|
4 |
+
* Tweak - WC 3.6 compatibility.
|
5 |
+
|
6 |
= 1.0.35 - 2019-02-01 =
|
7 |
* Fix - Idempotency key reuse issue when checking out.
|
8 |
|
includes/class-wc-square-client.php
CHANGED
@@ -272,7 +272,7 @@ class WC_Square_Client {
|
|
272 |
|
273 |
if ( ! is_null( $body ) ) {
|
274 |
if ( ! empty( $request_args['headers']['Content-Type'] ) && ( 'application/json' === $request_args['headers']['Content-Type'] ) ) {
|
275 |
-
$request_args['body'] =
|
276 |
} else {
|
277 |
$request_args['body'] = $body;
|
278 |
}
|
272 |
|
273 |
if ( ! is_null( $body ) ) {
|
274 |
if ( ! empty( $request_args['headers']['Content-Type'] ) && ( 'application/json' === $request_args['headers']['Content-Type'] ) ) {
|
275 |
+
$request_args['body'] = wp_json_encode( $body );
|
276 |
} else {
|
277 |
$request_args['body'] = $body;
|
278 |
}
|
includes/class-wc-square-connect.php
CHANGED
@@ -342,7 +342,7 @@ class WC_Square_Connect {
|
|
342 |
|
343 |
if ( ! empty( $category ) ) {
|
344 |
|
345 |
-
$square_cat_id =
|
346 |
|
347 |
$product['category_id'] = $square_cat_id;
|
348 |
|
342 |
|
343 |
if ( ! empty( $category ) ) {
|
344 |
|
345 |
+
$square_cat_id = WC_Square_Utils::wc_compat_get_term_meta( $category[0]->term_id, 'square_cat_id', true );
|
346 |
|
347 |
$product['category_id'] = $square_cat_id;
|
348 |
|
includes/class-wc-square-utils.php
CHANGED
@@ -333,7 +333,7 @@ class WC_Square_Utils {
|
|
333 |
* @return mixed See get_woocommerce_term_meta()
|
334 |
*/
|
335 |
public static function get_wc_term_square_id( $wc_term_id ) {
|
336 |
-
return
|
337 |
}
|
338 |
|
339 |
/**
|
@@ -344,7 +344,7 @@ class WC_Square_Utils {
|
|
344 |
* @return bool See update_woocommerce_term_meta()
|
345 |
*/
|
346 |
public static function update_wc_term_square_id( $wc_term_id, $square_id ) {
|
347 |
-
return
|
348 |
}
|
349 |
|
350 |
/**
|
@@ -936,4 +936,39 @@ class WC_Square_Utils {
|
|
936 |
|
937 |
return true;
|
938 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
939 |
}
|
333 |
* @return mixed See get_woocommerce_term_meta()
|
334 |
*/
|
335 |
public static function get_wc_term_square_id( $wc_term_id ) {
|
336 |
+
return WC_Square_Utils::wc_compat_get_term_meta( $wc_term_id, self::WC_TERM_SQUARE_ID );
|
337 |
}
|
338 |
|
339 |
/**
|
344 |
* @return bool See update_woocommerce_term_meta()
|
345 |
*/
|
346 |
public static function update_wc_term_square_id( $wc_term_id, $square_id ) {
|
347 |
+
return WC_Square_Utils::wc_compat_update_term_meta( $wc_term_id, self::WC_TERM_SQUARE_ID, $square_id );
|
348 |
}
|
349 |
|
350 |
/**
|
936 |
|
937 |
return true;
|
938 |
}
|
939 |
+
|
940 |
+
/**
|
941 |
+
*
|
942 |
+
* Updates a term meta. Compatibility function for WC 3.6.
|
943 |
+
*
|
944 |
+
* @since 1.0.36
|
945 |
+
* @param int $term_id Term ID.
|
946 |
+
* @param string $meta_key Meta key.
|
947 |
+
* @param mixed $meta_value Meta value.
|
948 |
+
* @return bool
|
949 |
+
*/
|
950 |
+
public static function wc_compat_update_term_meta( $term_id, $meta_key, $meta_value ) {
|
951 |
+
if ( version_compare( WC_VERSION, '3.6', 'ge' ) ) {
|
952 |
+
return update_term_meta( $term_id, $meta_key, $meta_value );
|
953 |
+
} else {
|
954 |
+
return update_woocommerce_term_meta( $term_id, $meta_key, $meta_value );
|
955 |
+
}
|
956 |
+
}
|
957 |
+
|
958 |
+
/**
|
959 |
+
* Gets a term meta. Compatibility function for WC 3.6.
|
960 |
+
*
|
961 |
+
* @since 1.0.36
|
962 |
+
* @param int $term_id Term ID.
|
963 |
+
* @param string $key Meta key.
|
964 |
+
* @param bool $single Whether to return a single value. (default: true).
|
965 |
+
* @return mixed
|
966 |
+
*/
|
967 |
+
public static function wc_compat_get_term_meta( $term_id, $key, $single = true ) {
|
968 |
+
if ( version_compare( WC_VERSION, '3.6', 'ge' ) ) {
|
969 |
+
return get_term_meta( $term_id, $key, $single );
|
970 |
+
} else {
|
971 |
+
return get_woocommerce_term_meta( $term_id, $key, $single );
|
972 |
+
}
|
973 |
+
}
|
974 |
}
|
includes/class-wc-square-wc-products.php
CHANGED
@@ -495,11 +495,11 @@ class WC_Square_WC_Products {
|
|
495 |
$term_id = intval( $term->term_id );
|
496 |
|
497 |
// Get category display type
|
498 |
-
$display_type =
|
499 |
|
500 |
// Get category image
|
501 |
$image = '';
|
502 |
-
if ( $image_id =
|
503 |
$image = wp_get_attachment_url( $image_id );
|
504 |
}
|
505 |
|
@@ -579,11 +579,11 @@ class WC_Square_WC_Products {
|
|
579 |
|
580 |
$id = $insert['term_id'];
|
581 |
|
582 |
-
|
583 |
|
584 |
// Check if image_id is a valid image attachment before updating the term meta.
|
585 |
if ( $image_id && wp_attachment_is_image( $image_id ) ) {
|
586 |
-
|
587 |
}
|
588 |
|
589 |
do_action( 'woocommerce_api_create_product_category', $id, $data );
|
@@ -650,11 +650,11 @@ class WC_Square_WC_Products {
|
|
650 |
}
|
651 |
|
652 |
if ( ! empty( $data['display'] ) ) {
|
653 |
-
|
654 |
}
|
655 |
|
656 |
if ( isset( $image_id ) ) {
|
657 |
-
|
658 |
}
|
659 |
|
660 |
do_action( 'woocommerce_api_edit_product_category', $id, $data );
|
495 |
$term_id = intval( $term->term_id );
|
496 |
|
497 |
// Get category display type
|
498 |
+
$display_type = WC_Square_Utils::wc_compat_get_term_meta( $term_id, 'display_type' );
|
499 |
|
500 |
// Get category image
|
501 |
$image = '';
|
502 |
+
if ( $image_id = WC_Square_Utils::wc_compat_get_term_meta( $term_id, 'thumbnail_id' ) ) {
|
503 |
$image = wp_get_attachment_url( $image_id );
|
504 |
}
|
505 |
|
579 |
|
580 |
$id = $insert['term_id'];
|
581 |
|
582 |
+
WC_Square_Utils::wc_compat_update_term_meta( $id, 'display_type', 'default' === $data['display'] ? '' : sanitize_text_field( $data['display'] ) );
|
583 |
|
584 |
// Check if image_id is a valid image attachment before updating the term meta.
|
585 |
if ( $image_id && wp_attachment_is_image( $image_id ) ) {
|
586 |
+
WC_Square_Utils::wc_compat_update_term_meta( $id, 'thumbnail_id', $image_id );
|
587 |
}
|
588 |
|
589 |
do_action( 'woocommerce_api_create_product_category', $id, $data );
|
650 |
}
|
651 |
|
652 |
if ( ! empty( $data['display'] ) ) {
|
653 |
+
WC_Square_Utils::wc_compat_update_term_meta( $id, 'display_type', 'default' === $data['display'] ? '' : sanitize_text_field( $data['display'] ) );
|
654 |
}
|
655 |
|
656 |
if ( isset( $image_id ) ) {
|
657 |
+
WC_Square_Utils::wc_compat_update_term_meta( $id, 'thumbnail_id', $image_id );
|
658 |
}
|
659 |
|
660 |
do_action( 'woocommerce_api_edit_product_category', $id, $data );
|
languages/woocommerce-square.pot
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
# This file is distributed under the same license as the WooCommerce Square package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WooCommerce Square 1.0.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://github.com/woocommerce/woocommerce-square/issues\n"
|
8 |
-
"POT-Creation-Date: 2019-
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
2 |
# This file is distributed under the same license as the WooCommerce Square package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce Square 1.0.36\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://github.com/woocommerce/woocommerce-square/issues\n"
|
8 |
+
"POT-Creation-Date: 2019-04-15 20:27:52+00:00\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
woocommerce-square.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Square
|
4 |
-
* Version: 1.0.
|
5 |
* Plugin URI: https://woocommerce.com/products/square/
|
6 |
* Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
|
7 |
* Author: WooCommerce
|
@@ -9,7 +9,7 @@
|
|
9 |
* Requires at least: 4.5.0
|
10 |
* Tested up to: 5.0
|
11 |
* WC requires at least: 2.6
|
12 |
-
* WC tested up to: 3.
|
13 |
* Text Domain: woocommerce-square
|
14 |
* Domain Path: /languages
|
15 |
*
|
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
|
24 |
if ( ! class_exists( 'Woocommerce_Square' ) ) :
|
25 |
|
26 |
-
define( 'WC_SQUARE_VERSION', '1.0.
|
27 |
|
28 |
/**
|
29 |
* Main class.
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Square
|
4 |
+
* Version: 1.0.36
|
5 |
* Plugin URI: https://woocommerce.com/products/square/
|
6 |
* Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
|
7 |
* Author: WooCommerce
|
9 |
* Requires at least: 4.5.0
|
10 |
* Tested up to: 5.0
|
11 |
* WC requires at least: 2.6
|
12 |
+
* WC tested up to: 3.6
|
13 |
* Text Domain: woocommerce-square
|
14 |
* Domain Path: /languages
|
15 |
*
|
23 |
|
24 |
if ( ! class_exists( 'Woocommerce_Square' ) ) :
|
25 |
|
26 |
+
define( 'WC_SQUARE_VERSION', '1.0.36' );
|
27 |
|
28 |
/**
|
29 |
* Main class.
|