Skip to main content
1 of 3

Incorrect prices in shopping cart via SOAP API v2

I'm not familiar with Magento API, may be this problem is very easy, but i don't know. Please, help me to fix this!

Store have configurable product, which costs 750 ("base version"), via API i want to buy configured product, which costs 1500. When I just try to get shoppingCartTotals(), i get right prices (with right tax), but when i try to get shipping and payment methods - prices changing O_O.

Here is code:

<?php
 
$proxy = new SoapClient('http://example.com/index.php/api/v2_soap/?wsdl');
$sessionId = $proxy->login('ApiUser', 'ApiKey');
 
$quoteId = $proxy->shoppingCartCreate( $sessionId, 3 );
 
/*$customerData = array(
    "firstname" => "-",
    "lastname" => "-",
    "email" => "[email protected]",
    "mode" => "guest",
    "website_id" => "0"
);*/
 
//$proxy->shoppingCartCustomerSet($sessionId, $quoteId, $customerData);
 
$proxy->shoppingCartCustomerAddresses($sessionId, $quoteId, array(array(
    'mode' => 'billing',
    'firstname' => '-',
    'lastname' => '-',
    'street' => '-',
    'city' => '-',
    'region' => '-',
    'postcode' => '-',
    'country_id' => 'UK',
    'telephone' => '-',
    'is_default_billing' => 1
)));
 
$proxy->shoppingCartProductAdd(
    $sessionId,
    $quoteId,
    array(
        array(
            'sku' => '111111',
            'qty' => '1',
            'options' => array(
                array(
                    "key" => 111,
                    "value" => 1212,
                )
            ),
        )
    ),
    3 //storeId
 
);
//Uncomment following lines for price changing
//$result_payment = $proxy->shoppingCartPaymentMethod($sessionId, $quoteId, array('method' => 'checkmo'), 3);
//$result_shipping = $proxy->shoppingCartShippingMethod($sessionId, $quoteId, 'freeshipping_freeshipping', 3);
//echo var_dump(array('shoppingCartPaymentMethod' => $result_payment,'shoppingCartShippingMethod' => $result_shipping)); 
 
//$result = $proxy->shoppingCartInfo($sessionId, $quoteId, 3);
//var_dump($result);
 
$result = $proxy->shoppingCartTotals($sessionId, $quoteId, 3);
var_dump($result);

And here is results:

  1. Without shipping and payment methods:

    array(3) { [0]=> object(stdClass)#2 (2) { ["title"]=> string(8) "Subtotal" ["amount"]=> float(1500) } [1]=> object(stdClass)#3 (2) { ["title"]=> string(3) "Tax" ["amount"]=> float(300) } [2]=> object(stdClass)#4 (2) { ["title"]=> string(11) "Grand Total" ["amount"]=> float(1500) } }

  2. With shipping and payment methods:

    array(2) { ["shoppingCartPaymentMethod"]=> bool(true) ["shoppingCartShippingMethod"]=> bool(true) } array(4) { [0]=> object(stdClass)#2 (2) { ["title"]=> string(8) "Subtotal" ["amount"]=> float(780) } [1]=> object(stdClass)#3 (2) { ["title"]=> string(3) "Tax" ["amount"]=> float(156) } [2]=> object(stdClass)#4 (2) { ["title"]=> string(40) "Shipping & Handling (Fri frakt - Gratis)" ["amount"]=> float(0) } [3]=> object(stdClass)#5 (2) { ["title"]=> string(11) "Grand Total" ["amount"]=> float(780) } }

What i doing wrong?