mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Fix simc filter
This commit is contained in:
parent
8f89226cb3
commit
5976139e8a
3 changed files with 10 additions and 5 deletions
|
@ -91,9 +91,8 @@ return array(
|
||||||
|
|
||||||
$tracking_enabled = $settings->has( 'tracking_enabled' ) && $settings->get( 'tracking_enabled' );
|
$tracking_enabled = $settings->has( 'tracking_enabled' ) && $settings->get( 'tracking_enabled' );
|
||||||
$is_gzd_active = $container->get( 'compat.gzd.is_supported_plugin_version_active' );
|
$is_gzd_active = $container->get( 'compat.gzd.is_supported_plugin_version_active' );
|
||||||
$should_sync_shipment = apply_filters( 'woocommerce_paypal_payments_sync_gzd_tracking', true );
|
|
||||||
|
|
||||||
return $tracking_enabled && $is_gzd_active && $should_sync_shipment;
|
return $tracking_enabled && $is_gzd_active;
|
||||||
},
|
},
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
|
@ -53,8 +53,9 @@ class CompatAssets {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function register(): void {
|
public function register(): void {
|
||||||
if ( $this->should_enqueue_gzd_scripts ) {
|
$gzd_sync_enabled = apply_filters( 'woocommerce_paypal_payments_sync_gzd_tracking', true );
|
||||||
wp_register_script(
|
if ( $this->should_enqueue_gzd_scripts && $gzd_sync_enabled ) {
|
||||||
|
wp_register_script(
|
||||||
'ppcp-gzd-compat',
|
'ppcp-gzd-compat',
|
||||||
untrailingslashit( $this->module_url ) . '/assets/js/gzd-compat.js',
|
untrailingslashit( $this->module_url ) . '/assets/js/gzd-compat.js',
|
||||||
array( 'jquery' ),
|
array( 'jquery' ),
|
||||||
|
@ -70,7 +71,8 @@ class CompatAssets {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function enqueue(): void {
|
public function enqueue(): void {
|
||||||
if ( $this->should_enqueue_gzd_scripts ) {
|
$gzd_sync_enabled = apply_filters( 'woocommerce_paypal_payments_sync_gzd_tracking', true );
|
||||||
|
if ( $this->should_enqueue_gzd_scripts && $gzd_sync_enabled ) {
|
||||||
wp_enqueue_script( 'ppcp-gzd-compat' );
|
wp_enqueue_script( 'ppcp-gzd-compat' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,6 +132,10 @@ class CompatModule implements ModuleInterface {
|
||||||
add_action(
|
add_action(
|
||||||
'woocommerce_gzd_shipment_after_save',
|
'woocommerce_gzd_shipment_after_save',
|
||||||
static function( Shipment $shipment ) use ( $endpoint, $logger, $status_map ) {
|
static function( Shipment $shipment ) use ( $endpoint, $logger, $status_map ) {
|
||||||
|
if ( ! apply_filters( 'woocommerce_paypal_payments_sync_gzd_tracking', true ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$gzd_shipment_status = $shipment->get_status();
|
$gzd_shipment_status = $shipment->get_status();
|
||||||
if ( ! array_key_exists( $gzd_shipment_status, $status_map ) ) {
|
if ( ! array_key_exists( $gzd_shipment_status, $status_map ) ) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue