本文整理匯總了PHP中Magento\Quote\Model\Quote::getCustomerGroupId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Quote::getCustomerGroupId方法的具體用法?PHP Quote::getCustomerGroupId怎麽用?PHP Quote::getCustomerGroupId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Quote\Model\Quote
的用法示例。
在下文中一共展示了Quote::getCustomerGroupId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isFreeShipping
/**
* {@inheritDoc}
*/
public function isFreeShipping(\Magento\Quote\Model\Quote $quote, $items)
{
/** @var \Magento\Quote\Api\Data\CartItemInterface[] $items */
if (!count($items)) {
return false;
}
$addressFreeShipping = true;
$store = $this->storeManager->getStore($quote->getStoreId());
$this->calculator->init($store->getWebsiteId(), $quote->getCustomerGroupId(), $quote->getCouponCode());
/** @var \Magento\Quote\Api\Data\CartItemInterface $item */
foreach ($items as $item) {
if ($item->getNoDiscount()) {
$addressFreeShipping = false;
$item->setFreeShipping(false);
continue;
}
/** Child item discount we calculate for parent */
if ($item->getParentItemId()) {
continue;
}
$this->calculator->processFreeShipping($item);
$itemFreeShipping = (bool) $item->getFreeShipping();
$addressFreeShipping = $addressFreeShipping && $itemFreeShipping;
/** Parent free shipping we apply to all children*/
$this->applyToChildren($item, $itemFreeShipping);
}
return $addressFreeShipping;
}
示例2: testGetCustomerGroupId
/**
* Customer group ID is set to quote object.
*/
public function testGetCustomerGroupId()
{
/** Preconditions */
$customerGroupId = 33;
$this->quote->setCustomerGroupId($customerGroupId);
/** SUT execution */
$this->assertEquals($customerGroupId, $this->quote->getCustomerGroupId(), "Customer group ID is invalid");
}