Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. public function collectRates(RateRequest $request)
  2. {
  3.  
  4. // Check if postcode is allowed
  5. if (!$this->isActive() || !$this->postcodeValidate($request->getDestPostcode()))
  6. {
  7. return false;
  8. }
  9.  
  10. $result = $this->_rateResultFactory->create();
  11. $shippingPrice = $this->getConfigData('price');
  12.  
  13. $method = $this->_rateMethodFactory->create();
  14.  
  15. $method->setCarrier($this->getCarrierCode());
  16. $method->setCarrierTitle($this->getConfigData('title'));
  17.  
  18. $method->setMethod($this->getCarrierCode());
  19. $method->setMethodTitle($this->getConfigData('name'));
  20.  
  21. $method->setPrice($shippingPrice);
  22. $method->setCost($shippingPrice);
  23.  
  24. $result->append($method);
  25. return $result;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement