-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Woo
committed
Jun 4, 2024
1 parent
a079134
commit 0e20c86
Showing
9 changed files
with
593 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
includes/compatibility/modules/class-wc-min-max-quantities-paypal-compatibility.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* WC_Min_Max_Quantities_PayPal_Compatibility class | ||
* | ||
* @package Woo Min Max Quantities | ||
* @since 4.3.2 | ||
*/ | ||
|
||
// Exit if accessed directly. | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
/** | ||
* PayPal Compatibility. | ||
* | ||
* @version 4.3.2 | ||
*/ | ||
class WC_Min_Max_Quantities_PayPal_Compatibility { | ||
|
||
// Hide smart buttons in product pages when Min or Max qty/value are set. | ||
public static function init() { | ||
add_filter( 'woocommerce_paypal_payments_product_supports_payment_request_button', array( __CLASS__, 'handle_smart_buttons' ), 10, 2 ); | ||
} | ||
|
||
/** | ||
* Hide smart buttons in product pages when Min or Max qty/value are set. | ||
* | ||
* @param bool $is_supported | ||
* @param WC_Product $product | ||
* | ||
* @return bool | ||
*/ | ||
public static function handle_smart_buttons( $is_supported, $product ) { | ||
// If the smart button is not supported by some other plugin, respect that. | ||
if ( ! $is_supported ) { | ||
return $is_supported; | ||
} | ||
|
||
$mmq_instance = WC_Min_Max_Quantities::get_instance(); | ||
return $mmq_instance->can_display_express_checkout( $product ); | ||
} | ||
} | ||
|
||
WC_Min_Max_Quantities_PayPal_Compatibility::init(); |
59 changes: 59 additions & 0 deletions
59
includes/compatibility/modules/class-wc-min-max-quantities-stripe-compatibility.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
/** | ||
* WC_Min_Max_Quantities_Stripe_Compatibility class | ||
* | ||
* @package Woo Min Max Quantities | ||
* @since 4.3.2 | ||
*/ | ||
|
||
// Exit if accessed directly. | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
/** | ||
* Stripe Compatibility. | ||
* | ||
* @version 4.3.2 | ||
*/ | ||
class WC_Min_Max_Quantities_Stripe_Compatibility { | ||
|
||
// Hide smart buttons in product pages when Min or Max qty/value are set. | ||
public static function init() { | ||
add_filter( 'wc_stripe_hide_payment_request_on_product_page', array( __CLASS__, 'handle_express_checkout_buttons' ), 10, 2 ); | ||
} | ||
|
||
/** | ||
* Hide express checkout buttons in product pages when Min or Max qty/value are set. | ||
* | ||
* @param bool $hide | ||
* @param WP_Post $post | ||
* | ||
* @return bool | ||
*/ | ||
public static function handle_express_checkout_buttons( $hide, $post = null ) { | ||
// If the button is already hidden by some other plugin, respect that. | ||
if ( $hide ) { | ||
return $hide; | ||
} | ||
|
||
if ( is_null( $post ) ) { | ||
global $post; | ||
} | ||
|
||
if ( ! is_object( $post ) || empty( $post->ID ) ) { | ||
return $hide; | ||
} | ||
|
||
$product = wc_get_product( $post->ID ); | ||
if ( $product && is_a( $product, 'WC_Product' ) ) { | ||
$mmq_instance = WC_Min_Max_Quantities::get_instance(); | ||
$hide = ! $mmq_instance->can_display_express_checkout( $product ); // the filter needs true for hiding the button. | ||
return $hide; | ||
} | ||
|
||
return $hide; | ||
} | ||
} | ||
|
||
WC_Min_Max_Quantities_Stripe_Compatibility::init(); |
46 changes: 46 additions & 0 deletions
46
includes/compatibility/modules/class-wc-min-max-quantities-wc-payments-compatibility.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* WC_Min_Max_Quantities_WC_Payments_Compatibility class | ||
* | ||
* @package Woo Min Max Quantities | ||
* @since 4.3.2 | ||
*/ | ||
|
||
// Exit if accessed directly. | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
/** | ||
* WC_Payments Compatibility. | ||
* | ||
* @version 4.3.2 | ||
*/ | ||
class WC_Min_Max_Quantities_WC_Payments_Compatibility { | ||
|
||
public static function init() { | ||
// Hide express checkout buttons in product pages when Min or Max qty/value are set. | ||
add_filter( 'wcpay_payment_request_is_product_supported', array( __CLASS__, 'handle_express_checkout_buttons' ), 10, 2 ); | ||
add_filter( 'wcpay_woopay_button_is_product_supported', array( __CLASS__, 'handle_express_checkout_buttons' ), 10, 2 ); | ||
} | ||
|
||
/** | ||
* Hide express checkout buttons in product pages when Min or Max qty/value are set. | ||
* | ||
* @param bool $is_supported | ||
* @param WC_Product $product | ||
* | ||
* @return bool | ||
*/ | ||
public static function handle_express_checkout_buttons( $is_supported, $product ) { | ||
// If the smart button is not supported by some other plugin, respect that. | ||
if ( ! $is_supported ) { | ||
return $is_supported; | ||
} | ||
|
||
$mmq_instance = WC_Min_Max_Quantities::get_instance(); | ||
return $mmq_instance->can_display_express_checkout( $product ); | ||
} | ||
} | ||
|
||
WC_Min_Max_Quantities_WC_Payments_Compatibility::init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,14 @@ | |
# This file is distributed under the GNU General Public License v3.0. | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Woo Min/Max Quantities 4.3.1\n" | ||
"Project-Id-Version: Woo Min/Max Quantities 4.3.2\n" | ||
"Report-Msgid-Bugs-To: https://woocommerce.com/my-account/create-a-ticket/\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"POT-Creation-Date: 2024-05-15T12:22:54+00:00\n" | ||
"POT-Creation-Date: 2024-06-04T09:20:25+00:00\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"X-Generator: WP-CLI 2.10.0\n" | ||
"language-team: LANGUAGE <EMAIL@ADDRESS>\n" | ||
|
@@ -244,82 +244,77 @@ msgstr "" | |
msgid "Support" | ||
msgstr "" | ||
|
||
#. translators: Group of quantity | ||
#: includes/api/class-wc-mmq-rest-api.php:143 | ||
#: includes/api/class-wc-mmq-rest-api.php:389 | ||
msgid "The minimum quantity must be a multiple of %d." | ||
#: includes/api/class-wc-mmq-rest-api.php:159 | ||
#: includes/api/class-wc-mmq-rest-api.php:483 | ||
msgid "The Allow Combinations option can only be set for Variable Products." | ||
msgstr "" | ||
|
||
#. translators: Minimum quantity | ||
#: includes/api/class-wc-mmq-rest-api.php:160 | ||
#: includes/api/class-wc-mmq-rest-api.php:405 | ||
msgid "The maximum quantity must be greater than %d, which is the Minimum Quantity." | ||
#: includes/api/class-wc-mmq-rest-api.php:186 | ||
#: includes/api/class-wc-mmq-rest-api.php:510 | ||
msgid "The minimum quantity must be less than %d, which is the Maximum Quantity." | ||
msgstr "" | ||
|
||
#. translators: Group of quantity | ||
#: includes/api/class-wc-mmq-rest-api.php:165 | ||
#: includes/api/class-wc-mmq-rest-api.php:410 | ||
msgid "The maximum quantity must be a multiple of %d." | ||
#: includes/api/class-wc-mmq-rest-api.php:191 | ||
#: includes/api/class-wc-mmq-rest-api.php:515 | ||
msgid "The minimum quantity must be a multiple of %d." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:184 | ||
#: includes/api/class-wc-mmq-rest-api.php:432 | ||
msgid "The Allow Combinations option can only be set for Variable Products." | ||
#. translators: Group of quantity | ||
#: includes/api/class-wc-mmq-rest-api.php:196 | ||
#: includes/api/class-wc-mmq-rest-api.php:520 | ||
msgid "The maximum quantity must be a multiple of %d." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:199 | ||
#: includes/api/class-wc-mmq-rest-api.php:253 | ||
msgid "Enable this option to set quantity rules for a specific variation." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:205 | ||
#: includes/api/class-wc-mmq-rest-api.php:259 | ||
msgid "Require variations to be purchased in multiples of this value." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:210 | ||
#: includes/api/class-wc-mmq-rest-api.php:264 | ||
msgid "Minimum required variation quantity." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:215 | ||
#: includes/api/class-wc-mmq-rest-api.php:269 | ||
msgid "Maximum allowed variation quantity." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:220 | ||
#: includes/api/class-wc-mmq-rest-api.php:274 | ||
msgid "Exclude variation from order quantity and value rules." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:226 | ||
#: includes/api/class-wc-mmq-rest-api.php:280 | ||
msgid "Exclude variation from category quantity rules." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:271 | ||
#: includes/api/class-wc-mmq-rest-api.php:322 | ||
msgid "Require products to be purchased in multiples of this value." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:276 | ||
#: includes/api/class-wc-mmq-rest-api.php:327 | ||
msgid "Minimum required product quantity." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:281 | ||
#: includes/api/class-wc-mmq-rest-api.php:332 | ||
msgid "Maximum allowed product quantity." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:286 | ||
#: includes/api/class-wc-mmq-rest-api.php:337 | ||
msgid "Exclude product from order quantity and value rules." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:292 | ||
#: includes/api/class-wc-mmq-rest-api.php:343 | ||
msgid "Exclude product from category quantity rules." | ||
msgstr "" | ||
|
||
#: includes/api/class-wc-mmq-rest-api.php:298 | ||
#: includes/api/class-wc-mmq-rest-api.php:349 | ||
msgid "Enable this option to combine the quantities of all purchased variations when checking quantity rules." | ||
msgstr "" | ||
|
||
#. translators: Minimum quantity | ||
#: includes/api/class-wc-mmq-rest-api.php:384 | ||
msgid "The minimum quantity must be less than %d, which is the Maximum Quantity." | ||
msgstr "" | ||
|
||
#: includes/class-wc-min-max-quantities-blocks.php:59 | ||
#: includes/class-wc-min-max-quantities-blocks.php:138 | ||
msgid "Sell in groups of" | ||
|
@@ -365,8 +360,8 @@ msgstr "" | |
msgid "Enter a maximum quantity customers can buy in a single order. This is particularly useful for items that have limited quantity, like art or handmade goods." | ||
msgstr "" | ||
|
||
#: includes/compatibility/class-wc-min-max-quantities-compatibility.php:65 | ||
#: includes/compatibility/class-wc-min-max-quantities-compatibility.php:74 | ||
#: includes/compatibility/class-wc-min-max-quantities-compatibility.php:66 | ||
#: includes/compatibility/class-wc-min-max-quantities-compatibility.php:75 | ||
msgid "Foul!" | ||
msgstr "" | ||
|
||
|
Oops, something went wrong.