0

We call the Rest API with "/rest/V1/carts/mine".

Where is the code located in magento?

1 Answer 1

1

You need to search the api definition

<route url="/V1/carts/mine" method="GET">
    <service class="Magento\Quote\Api\CartManagementInterface" method="getCartForCustomer"/>
    <resources>
        <resource ref="self" />
    </resources>
    <data>
        <parameter name="customerId" force="true">%customer_id%</parameter>
    </data>
</route>

The interface is provided there.

Then you need to search the class implementing the interface, or to go faster directly the method name

This is how you end up finding

src/vendor/magento/module-quote/Model/QuoteManagement.php

/**
 * @inheritdoc
 */
public function getCartForCustomer($customerId)
{
    return $this->quoteRepository->getActiveForCustomer($customerId);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.