Warning: You are browsing the documentation for PrestaShop 1.7, which is outdated.

You might want to read an updated version of this page for the current version, PrestaShop 8. Read the updated version of this page

Learn how to upgrade to the latest version.

Cart domain

Cart Commands

AddCartRuleToCartCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\AddCartRuleToCartCommand Adds cart rule to given cart.

Command details
Constructor parameters
  • $int $cartId
  • $int $cartRuleId
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\AddCartRuleToCartHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\AddCartRuleToCartHandlerInterface
Return type void

AddCustomizationCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\AddCustomizationCommand Adds product customization

Command details
Constructor parameters
  • $int $cartId
  • $int $productId
  • $array $customizationValuesByFieldIds
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\AddCustomizationHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\AddCustomizationHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Product\Customization\ValueObject\CustomizationId

AddProductToCartCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\AddProductToCartCommand Responsible for adding product to cart

Command details
Constructor parameters
  • $int $cartId
  • $int $productId
  • $int $quantity
  • $?int $combinationId = NULL
  • `$array $customizationsByFieldIds = array (
)`
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\AddProductToCartHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\AddProductToCartHandlerInterface
Return type void

CreateEmptyCustomerCartCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\CreateEmptyCustomerCartCommand Creates empty cart for given customer.

Command details
Constructor parameters
  • $int $customerId
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\CreateEmptyCustomerCartHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\CreateEmptyCustomerCartHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Cart\ValueObject\CartId

RemoveCartRuleFromCartCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\RemoveCartRuleFromCartCommand Removes given cart rule from cart.

Command details
Constructor parameters
  • $int $cartId
  • $int $cartRuleId
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\RemoveCartRuleFromCartHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\RemoveCartRuleFromCartHandlerInterface
Return type void

RemoveProductFromCartCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\RemoveProductFromCartCommand Removes given product from cart.

Command details
Constructor parameters
  • $int $cartId
  • $int $productId
  • $?int $combinationId = NULL
  • $?int $customizationId = NULL
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\RemoveProductFromCartHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\RemoveProductFromCartHandlerInterface
Return type void

SendCartToCustomerCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\SendCartToCustomerCommand Sends email to the customer to process the payment for cart.

Command details
Constructor parameters
  • $int $cartId
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\SendCartToCustomerHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\SendCartToCustomerHanlderInterface
Return type void

UpdateCartAddressesCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\UpdateCartAddressesCommand __

Command details
Constructor parameters
  • $int $cartId
  • $int $newDeliveryAddressId
  • $int $newInvoiceAddressId
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateCartAddressesHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\UpdateCartAddressesHandlerInterface
Return type void

UpdateCartCarrierCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\UpdateCartCarrierCommand Updates cart carrier (a.k.a delivery option) with new one.

Command details
Constructor parameters
  • $int $cartId
  • $int $newCarrierId
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateCartCarrierHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\UpdateCartCarrierHandlerInterface
Return type void

UpdateCartCurrencyCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\UpdateCartCurrencyCommand Updates cart currency

Command details
Constructor parameters
  • $int $cartId
  • $int $newCurrencyId
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateCartCurrencyHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\UpdateCartCurrencyHandlerInterface
Return type void

UpdateCartDeliverySettingsCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\UpdateCartDeliverySettingsCommand __

Command details
Constructor parameters
  • $int $cartId
  • $bool $allowFreeShipping
  • $?bool $isAGift = NULL
  • $?bool $useRecycledPackaging = NULL
  • $?string $giftMessage = NULL
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateCartDeliverySettingsHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\UpdateCartDeliverySettingsHandlerInterface
Return type void

UpdateCartLanguageCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\UpdateCartLanguageCommand Updates language for given cart

Command details
Constructor parameters
  • $int $cartId
  • $int $newLanguageId
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateCartLanguageHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\UpdateCartLanguageHandlerInterface
Return type void

UpdateProductPriceInCartCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\UpdateProductPriceInCartCommand Updates cart product price

Command details
Constructor parameters
  • $int $cartId
  • $int $productId
  • $int $combinationId
  • $float $price
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateProductPriceInCartHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\UpdateProductPriceInCartHandlerInterface
Return type void

UpdateProductQuantityInCartCommand

PrestaShop\PrestaShop\Core\Domain\Cart\Command\UpdateProductQuantityInCartCommand Updates product quantity in cart Quantity given must include gift product

Command details
Constructor parameters
  • $int $cartId
  • $int $productId
  • $int $quantity
  • $?int $combinationId = NULL
  • $?int $customizationId = NULL
Handler class PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateProductQuantityInCartHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\CommandHandler\UpdateProductQuantityInCartHandlerInterface
Return type void

Cart Queries

GetCartForOrderCreation

PrestaShop\PrestaShop\Core\Domain\Cart\Query\GetCartForOrderCreation Query for getting cart information

Query details
Constructor parameters
  • $int $cartId
Handler class PrestaShop\PrestaShop\Adapter\Cart\QueryHandler\GetCartForOrderCreationHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\QueryHandler\GetCartForOrderCreationHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Cart\QueryResult\CartForOrderCreation

GetCartForViewing

PrestaShop\PrestaShop\Core\Domain\Cart\Query\GetCartForViewing Get cart for viewing in Back Office

Query details
Constructor parameters
  • $int $cartId
Handler class PrestaShop\PrestaShop\Adapter\Cart\QueryHandler\GetCartForViewingHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\QueryHandler\GetCartForViewingHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Cart\QueryResult\CartView

GetLastEmptyCustomerCart

PrestaShop\PrestaShop\Core\Domain\Cart\Query\GetLastEmptyCustomerCart Query for retrieving last empty cart for customer

Query details
Constructor parameters
  • $int $customerId
Handler class PrestaShop\PrestaShop\Adapter\Cart\QueryHandler\GetLastEmptyCustomerCartHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Cart\QueryHandler\GetLastEmptyCustomerCartHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Cart\ValueObject\CartId