/var/www/html/wp-content/plugins/checkout-for-woocommerce/includes/Compatibility/Gateways/In3.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

namespace Objectiv\Plugins\Checkout\Compatibility\Gateways;

use 
Objectiv\Plugins\Checkout\Compatibility\CompatibilityAbstract;

class 
In3 extends CompatibilityAbstract {
    public function 
is_available(): bool {
        return 
defined'Woosa_IN3\PREFIX' );
    }

    public function 
pre_init() {
        
add_action'cfw_get_payment_methods_html', array( $this'override_shipping_address_flag' ), 10 );
        
add_action'cfw_before_process_checkout', array( $this'override_shipping_address_flag' ), 10 );
    }

    public function 
override_shipping_address_flag() {
        if ( isset( 
$_POST['bill_to_different_address'] ) && 'same_as_shipping' === $_POST['bill_to_different_address'] ) {
            
$_POST['ship_to_different_address'] = 0;

            if ( isset( 
$_POST['post_data'] ) ) {
                
$post_data = array();

                
parse_str$_POST['post_data'], $post_data );

                
$post_data['ship_to_different_address'] = 0;

                
$_POST['post_data'] = http_build_query$post_data );
            }
        }
    }
}