-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: forcing the subscription auto renewal to be turned off * fix: removing static methods from WCSRenewalDisable * fix: missing dependencie validation * fix: verification for display the missing dependecies notice * docs: atualizando arquivos de documentação do plugin * fix: codeclimate errors * fix: codeclimate errors * fix: codeclimate errors * fix: codeclimate errors * fix: codeclimate errors * fix: codeclimate errors * fix: verificação de dependencias * fix: require PostMeta.php file on main file to avoid the fatal error when a new product is created * fix: codeclimate issues * fix: codeclimate issues * empty commit
- Loading branch information
Showing
8 changed files
with
94 additions
and
50 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
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
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,40 @@ | ||
<?php | ||
|
||
namespace VindiPaymentGateways; | ||
|
||
class VindiWCSRenewalDisable | ||
{ | ||
public function __construct() | ||
{ | ||
// Hook as early as possible to try disabling WC_Subcriptions_Manager handling | ||
add_action('wp_loaded', [$this, 'hook_before_prepare_renewal'], 1); | ||
} | ||
|
||
public function hook_before_prepare_renewal() | ||
{ | ||
if (class_exists('WC_Subscriptions_Manager', false)) { | ||
add_action('woocommerce_scheduled_subscription_payment', [ | ||
$this, | ||
'deactivate_renewal_prepare' | ||
], 0, 1); | ||
} | ||
} | ||
|
||
public function deactivate_renewal_prepare($subscription_id) | ||
{ | ||
$subscription = wcs_get_subscription($subscription_id); | ||
|
||
// Check if this subscriptions is a Vindi Subscription | ||
if (empty($subscription->get_meta('vindi_wc_subscription_id')) | ||
&& empty($subscription->get_meta('vindi_subscription_id'))) { | ||
return; | ||
} | ||
|
||
// Disable Woocommerce Subscriptions Renewal order and let Vindi handle it via webhooks | ||
remove_action( | ||
'woocommerce_scheduled_subscription_payment', | ||
'WC_Subscriptions_Manager::prepare_renewal', | ||
1 | ||
); | ||
} | ||
} |
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
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