cart->get_cart(); //Box Weight $boxTotalWeight = 0; $TaxableProductPrice = 0; $NonTaxableProductPrice = 0; foreach ($items as $item => $values) { //Product is varibale or simple so fetch value as per if ($values['variation_id']) { $_product = wc_get_product($values['variation_id']); } elseif ($values['product_id'] == "") { $_product = wc_get_product($values['data']->get_id()); } else { $_product = wc_get_product($values['product_id']); } // Total Weight if ($_product->get_weight() != "") { $boxTotalWeight += ($_product->get_weight() * $values['quantity']); } //check taxbale if ($_product->is_taxable()) { $TaxableProductPrice += ($_product->get_price() * $values['quantity']); } //check Nontaxbale if ($_product->is_taxable() == false) { $NonTaxableProductPrice += ($_product->get_price() * $values['quantity']); } // check taxable value and set amount } //Get Coupon Value if ($woocommerce->cart->get_applied_coupons()['0'] != "") { $coupons_obj = new WC_Coupon($woocommerce->cart->get_applied_coupons()['0']); $coupons_amount = $woocommerce->cart->get_subtotal() * $coupons_obj->get_amount() / 100; } //Get Coupon Value if (wc_tax_enabled() == true) { $TotalTaxable = (($woocommerce->cart->get_subtotal() + $woocommerce->cart->tax_total) - $coupons_amount); } //Get Taxable Value if ($TaxableProductPrice != "") { $TotalTaxbaleProductPrice = ($TaxableProductPrice + $woocommerce->cart->tax_total); } $pieces = parse_url(home_url()); $domain = isset($pieces['host']) ? $pieces['host'] : ''; if (preg_match('/(?P[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) { $domainname = strstr($regs['domain'], '.', true); } //getfoundsocial $xml_data = " BD8h3Dhs7qj18shr2p " . $domainname . " " . ($woocommerce->cart->cart_contents_total + $woocommerce->cart->tax_total) . " " . $TotalTaxbaleProductPrice . " " . $NonTaxableProductPrice . " " . $boxTotalWeight . " " . $woocommerce->customer->get_address() . " " . $woocommerce->customer->get_address_2() . " " . $woocommerce->customer->get_city() . " " . $woocommerce->customer->get_state() . " " . $woocommerce->customer->get_shipping_postcode() . " " . $woocommerce->customer->get_country() . " "; foreach ($items as $item => $values) { //Product is varibale or simple so fetch value as per if ($values['variation_id'] != "") { $_product = wc_get_product($values['variation_id']); $getcmeta = get_post_meta($values['product_id']); } elseif ($values['product_id'] == "") { $_product = wc_get_product($values['data']->get_id()); $getcmeta = get_post_meta($values['data']->get_id()); } else { $_product = wc_get_product($values['product_id']); $getcmeta = get_post_meta($values['product_id']); } $color = $values['variation']['attribute_pa_color']; $size = $values['variation']['attribute_pa_size']; if ($color != "") { $colorSize = ""; $colorSize .= ""; } else { $colorSize = ""; } $xml_data .= ""; $xml_data .= "" . $_product->get_sku() . " " . $values['quantity'] . " " . $_product->get_price() . " $colorSize " . $_product->get_name() . " " . $_product->get_regular_price() . " " . $_product->get_sale_price() . " " . $_product->get_weight() . " " . ($_product->get_tax_status() == 'taxable' ? 'Y' : 'N') . " N " . $getcmeta['asmplsww_dimensions'][0] . " " . ($getcmeta['asmplsww_free_shipping']['0'] == 1 ? 'Y' : 'N') . " " . $getcmeta['asmplsww_free_shipping_method'][0] . " " . ($getcmeta['asmplsww_ship_alone']['0'] == 1 ? 'Y' : 'N') . " " . $getcmeta['asmplsww_origin_zip'][0] . " " . $getcmeta['asmplsww_addons_number_boxes'][0] . " " . $getcmeta['asmplsww_multi_box_weight'][0] . " " . $getcmeta['asmplsww_addons_multi_box_points'][0] . " " . $getcmeta['asmplsww_invalid_ship_methods'][0] . " " . $getcmeta['asmplsww_markup'][0] . " " . $getcmeta['asmplsww_addons_item_points'][0] . " " . $getcmeta['asmplsww_addons_bundled_qty'][0] . " " . $getcmeta['asmplsww_addons_bundled_weight'][0] . " " . $getcmeta['asmplsww_addons_bundled_dimension'][0] . " " . $getcmeta['asmplsww_addons_bundled_points'][0] . " " . ($getcmeta['asmplsww_global_free_ship_exclusion']['0'] == 1 ? 'Y' : 'N') . " " . $getcmeta['asmplsww_addons_process_time']['0'] . " " . $getcmeta['asmplsww_exclude_state']['0'] . " " . $getcmeta['asmplsww_exclude_countries']['0'] . " " . ($getcmeta['asmplsww_addons_hazmat']['0'] == 1 ? 'Y' : 'N') . " " . $getcmeta['asmplsww_addons_options_weight_points']['0'] . " "; } $xml_data .= " " . $woocommerce->cart->get_applied_coupons()['0'] . " " . $coupons_amount . " ";