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