Woocommerce – Amazon pay – shipping charges
-
Pay with Amazon does not pick up the shipping charges on the cart total. What has to be added to the below code so that it does
/** create xml of the basic product **/ /** create xml of the basic product **/ $Item = $doc->createElement('Item'); $Item = $Items->appendChild($Item); $sku = $this->replace_char($sku); $sku = htmlentities($sku,ENT_QUOTES,'UTF-8'); $SKU = $doc->createElement('SKU',$sku); $SKU = $Item->appendChild($SKU); $MerchantId = $doc->createElement('MerchantId',$merchantID); $MerchantId = $Item->appendChild($MerchantId); $title = $this->replace_char($title); $title = htmlentities($title,ENT_QUOTES,'UTF-8'); $Title = $doc->createElement('Title',$title); $Title = $Item->appendChild($Title); $description = $this->replace_char($description); $description = htmlentities($description,ENT_QUOTES,'UTF-8'); $Description = $doc->createElement('Description',$title); $Description = $Item->appendChild($Description); $Price = $doc->createElement('Price'); $Price = $Item->appendChild($Price); $Amount = $doc->createElement('Amount',$amazon_product_price); $Amount = $Price->appendChild($Amount); $CurrencyCode = $doc->createElement('CurrencyCode',$currency); $CurrencyCode = $Price->appendChild($CurrencyCode); $Quantity = $doc->createElement('Quantity',$quantity); $Quantity = $Item->appendChild($Quantity); if($weight) { $Weight = $doc->createElement('Weight'); $Weight = $Item->appendChild($Weight); $Amount_wt = $doc->createElement('Amount',$weight); $Amount_wt = $Weight->appendChild($Amount_wt); $Wt_unit = $doc->createElement('Unit',$weight_unit); $Wt_unit = $Weight->appendChild($Wt_unit); } $this->easyshipattributes($doc,$Item); $ItemCustomData = $doc->createElement('ItemCustomData'); $ItemCustomData = $Item->appendChild($ItemCustomData); $Product_id = $doc->createElement('Product_id',$item['product_id']); $Product_id = $ItemCustomData->appendChild($Product_id); $Variation_id = $doc->createElement('Variation_id',$variation_id); $Variation_id = $ItemCustomData->appendChild($Variation_id); foreach ($variations as $key => $variant) { $Item_attribute = $doc->createElement('Item_attribute'); $Item_attribute = $ItemCustomData->appendChild($Item_attribute); $key = substr($key,0,40); $key = $this->replace_char($key); $key = htmlentities($key,ENT_QUOTES,'UTF-8'); $Attribute_name = $doc->createElement('Attribute_name',$key); $Attribute_name = $Item_attribute->appendChild($Attribute_name); $variant = substr($variant,0,40); $variant = $this->replace_char($variant); $variant = htmlentities($variant,ENT_QUOTES,'UTF-8'); $Attribute_val = $doc->createElement('Attribute_val',$variant); $Attribute_val = $Item_attribute->appendChild($Attribute_val); } } foreach ($all_fees as $fee) { $fees_Amout = $fee->amount+$fee->tax; if($fees_Amout > 0) { $Item = $doc->createElement('Item'); $Item = $Items->appendChild($Item); $fee_id = substr($fee->id,0,40); $fee_id = $this->replace_char($fee_id); $fee_id = htmlentities($fee_id,ENT_QUOTES,'UTF-8'); $SKU = $doc->createElement('SKU',$fee_id); $SKU = $Item->appendChild($SKU); $MerchantId = $doc->createElement('MerchantId',$merchantID); $MerchantId = $Item->appendChild($MerchantId); $fee_name = substr($fee->name,0,80); if(!$fee_name) $fee_name = 'Order Fees'; $fee_name = $this->replace_char($fee_name); $fee_name = htmlentities($fee_name,ENT_QUOTES,'UTF-8'); $Title = $doc->createElement('Title',$fee_name); $Title = $Item->appendChild($Title); $Description = $doc->createElement('Description','extra fees'); $Description = $Item->appendChild($Description); $Price = $doc->createElement('Price'); $Price = $Item->appendChild($Price); $Amount = $doc->createElement('Amount',$fees_Amout); $Amount = $Price->appendChild($Amount); $CurrencyCode = $doc->createElement('CurrencyCode',$currency); $CurrencyCode = $Price->appendChild($CurrencyCode); $Quantity = $doc->createElement('Quantity',1); $Quantity = $Item->appendChild($Quantity); } } $ReturnUrl = $doc->createElement('ReturnUrl',$return_url); $ReturnUrl = $root->appendChild($ReturnUrl); return $doc->saveXML(); } public function replace_char($string) { $string = str_replace('&','',$string); $string = str_replace('<','',$string); $string = str_replace('>','',$string); $string = str_replace('"','',$string); $string = str_replace("'","",$string); return $string; } public function easyshipattributes($doc,$Item) { $pwacheckkout = new Pwacheckout(); if($pwacheckkout->get_option('pwa_enable_easyship')) { $pwa_easyship_category = $pwacheckkout->get_option('pwa_easyship_category'); $pwa_easyship_hazmat = $pwacheckkout->get_option('pwa_easyship_hazmat'); $Category = $doc->createElement("Category"); $Category->appendChild($doc->createCDATASection(html_entity_decode($pwa_easyship_category))); $Item->appendChild($doc->importNode($Category)); $Hazmat = $doc->createElement('Hazmat',$pwa_easyship_hazmat); $Hazmat = $Item->appendChild($Hazmat); } $pwa_easyship_min_days = $pwacheckkout->get_option('pwa_easyship_min_days'); $pwa_easyship_max_days = $pwacheckkout->get_option('pwa_easyship_max_days'); if($pwa_easyship_min_days > 0 && $pwa_easyship_max_days > 0) { $HandlingTime = $doc->createElement('HandlingTime'); $HandlingTime = $Item->appendChild($HandlingTime); $MinDays = $doc->createElement('MinDays',$pwa_easyship_min_days); $MinDays = $HandlingTime->appendChild($MinDays); $MaxDays = $doc->createElement('MaxDays',$pwa_easyship_max_days); $MaxDays = $HandlingTime->appendChild($MaxDays); } } }
- The topic ‘Woocommerce – Amazon pay – shipping charges’ is closed to new replies.