Skip to content
Snippets Groups Projects
Commit 546cac01 authored by Billy Griffiths's avatar Billy Griffiths
Browse files

better way of getting the baseURL

parent f90353ce
No related branches found
No related tags found
No related merge requests found
...@@ -188,11 +188,8 @@ class CustomShipping extends AbstractCarrierOnline implements CarrierInterface ...@@ -188,11 +188,8 @@ class CustomShipping extends AbstractCarrierOnline implements CarrierInterface
*/ */
public function getBaseUrl(): string public function getBaseUrl(): string
{ {
$storeBase = $this->_storeManager->getStore()->getBaseUrl(); $storeBaseUrl = $this->_storeManager->getStore()->getBaseUrl();
// Strip slashes and http:// or https:// and wwww. from the url leaving just "example.com" return parse_url($storeBaseUrl)["host"];
$storeBase = preg_replace('/(http:\/\/|https:\/\/|www\.)/', '', $storeBase);
$storeBase = preg_replace('/(\/)/', '', $storeBase);
return $storeBase;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment