HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/bwcdev/wp-content/themes/salient/1111woocommerce_hooks.php
<?php
require __DIR__ . '/vendor/autoload.php';
add_action( 'woocommerce_new_order', 'bwc_new_order' );
function bwc_new_order( $order_id ) {
    $the_order = wc_get_order( $order_id );


    $customer_id = $the_order->get_customer_id();
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => 'https://shootinschool.spericorn.com/wp-json/wc/v3/orders',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_POSTFIELDS =>'{
        
        "parent_id": 0,
        "status": "completed",
        "currency": "USD",
        "version": "6.8.2",
        "prices_include_tax": false,
        "date_created": "2024-02-16T15:26:10",
        "date_modified": "2024-02-16T15:26:25",
        "discount_total": "0.00",
        "discount_tax": "0.00",
        "shipping_total": "0.00",
        "shipping_tax": "0.00",
        "cart_tax": "0.00",
        "total": "450.00",
        "total_tax": "0.00",
        "customer_id": 3389,
        "order_key": "wc_order_Pd9vLkkCgG6PK",
        "billing": {
            "first_name": "Abhishek",
            "last_name": "Nair",
            "company": "Dev",
            "address_1": "510 Townsend Street",
            "address_2": "Townsend St",
            "city": "Thiruvananthapuram",
            "state": "KL",
            "postcode": "695584",
            "country": "IN",
            "email": "abhishek+228855@spericorn.com",
            "phone": "08289899343"
        },
        "shipping": {
            "first_name": "",
            "last_name": "",
            "company": "",
            "address_1": "",
            "address_2": "",
            "city": "",
            "state": "",
            "postcode": "",
            "country": "",
            "phone": ""
        },
        "payment_method": "yith-stripe",
        "payment_method_title": "Credit Card",
        "transaction_id": "ch_2OkO9Q9GOnIA4dMQ1j893YEp",
        "customer_ip_address": "192.168.1.1",
        "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0",
        "created_via": "checkout",
        "customer_note": "",
        "date_completed": "2024-02-16T15:26:25",
        "date_paid": "2024-02-16T15:26:16",
        "cart_hash": "d91479267621856067c9c9ae5328c46c",
        "meta_data": [
            {
                "id": 347444,
                "key": "_billing_billing_phone",
                "value": "09633115262"
            },
            {
                "id": 347445,
                "key": "is_vat_exempt",
                "value": "no"
            },
            {
                "id": 347446,
                "key": "billing_billing_phone",
                "value": "09633115262"
            },
            {
                "id": 347447,
                "key": "es_wc_activecampaign_opt_in",
                "value": "no"
            },
            {
                "id": 347448,
                "key": "WooCommerceEventsOrderTickets",
                "value": []
            },
            {
                "id": 347449,
                "key": "WooCommerceEventsTicketsPurchased",
                "value": []
            },
            {
                "id": 347451,
                "key": "intent_id",
                "value": "pi_2OkO9Q9GOnIA4dMQ1J9okN1O"
            },
            {
                "id": 347459,
                "key": "_new_order_email_sent",
                "value": "true"
            },
            {
                "id": 347462,
                "key": "_captured",
                "value": "yes"
            },
            {
                "id": 347463,
                "key": "_captured",
                "value": "yes"
            },
            {
                "id": 347464,
                "key": "_stripe_customer_id",
                "value": "cus_PZXDXC68ZnENdi"
            }
        ],
        "line_items": [
            {
               "name": "Individual Instruction",
                "product_id": 1794,
                "variation_id": 0,
                "quantity": 1,
                "tax_class": "",
                "subtotal": "450.00",
                "subtotal_tax": "0.00",
                "total": "450.00",
                "total_tax": "0.00",
                "taxes": [],
                
                "sku": "",
                "price": 450,
                "image": {
                    "id": "2675",
                    "src": "https://shootinschool.spericorn.com/wp-content/uploads/2018/04/Optimized-1.jpg"
                }
                
            }
        ],
        "tax_lines": [],
        "shipping_lines": [],
        "fee_lines": [],
        "coupon_lines": [],
        "refunds": [],
       "is_editable": false,
        "needs_payment": false,
        "needs_processing": true,
        "date_created_gmt": "2024-02-16T09:56:10",
        "date_modified_gmt": "2024-02-16T09:56:25",
        "date_completed_gmt": "2024-02-16T09:56:25",
        "date_paid_gmt": "2024-02-16T09:56:16",
        "currency_symbol": "$",
        "_links": {
            "self": [
                {
                    "href": "https://shootinschool.spericorn.com/wp-json/wc/v3/orders/18466"
                }
            ],
            "collection": [
                {
                    "href": "https://shootinschool.spericorn.com/wp-json/wc/v3/orders"
                }
            ],
            "customer": [
                {
                    "href": "https://shootinschool.spericorn.com/wp-json/wc/v3/customers/3399"
                }
            ]
        }
    }',
      CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
        'Authorization: Basic Y2tfNzQ0ZjQ4MTQ2Yzc3Y2FhMmUxNGM4NDQzOGQ1NTEwNjcxYTZiOTQzZDpjc19hOGY3MmI4MjliZWRkZmVlYThhOTgzOGUwOWMxMDExNGJhNDBmZjhm',
        'Cookie: PHPSESSID=4re938p29ghdn84ojbco5jcc5l'
      ),
    ));
    
    $response = curl_exec($curl);
    
    curl_close($curl);
    echo $response;
    
}