Fix simc filter

This commit is contained in:
Narek Zakarian 2022-10-07 16:47:28 +04:00
parent 8f89226cb3
commit 5976139e8a
3 changed files with 10 additions and 5 deletions

View file

@ -91,9 +91,8 @@ return array(
$tracking_enabled = $settings->has( 'tracking_enabled' ) && $settings->get( 'tracking_enabled' );
$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;
},
);

View file

@ -53,8 +53,9 @@ class CompatAssets {
* @return void
*/
public function register(): void {
if ( $this->should_enqueue_gzd_scripts ) {
wp_register_script(
$gzd_sync_enabled = apply_filters( 'woocommerce_paypal_payments_sync_gzd_tracking', true );
if ( $this->should_enqueue_gzd_scripts && $gzd_sync_enabled ) {
wp_register_script(
'ppcp-gzd-compat',
untrailingslashit( $this->module_url ) . '/assets/js/gzd-compat.js',
array( 'jquery' ),
@ -70,7 +71,8 @@ class CompatAssets {
* @return 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' );
}
}

View file

@ -132,6 +132,10 @@ class CompatModule implements ModuleInterface {
add_action(
'woocommerce_gzd_shipment_after_save',
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();
if ( ! array_key_exists( $gzd_shipment_status, $status_map ) ) {
return;