Fix LYS private link query parameter when permalink is plain (#48425)
* Properly build URL query parameters * Changelog
This commit is contained in:
parent
a7fc9afa8e
commit
641370aa4e
|
@ -70,16 +70,23 @@ const SiteVisibility = () => {
|
||||||
const [ copyLinkText, setCopyLinkText ] = useState( copyLink );
|
const [ copyLinkText, setCopyLinkText ] = useState( copyLink );
|
||||||
|
|
||||||
const getPrivateLink = () => {
|
const getPrivateLink = () => {
|
||||||
|
const settings = window?.wcSettings;
|
||||||
|
const homeUrl = settings?.homeUrl;
|
||||||
|
const urlObject = new URL( homeUrl );
|
||||||
|
|
||||||
if ( storePagesOnly === 'yes' ) {
|
if ( storePagesOnly === 'yes' ) {
|
||||||
return (
|
const shopPermalink =
|
||||||
window?.wcSettings?.admin?.siteVisibilitySettings
|
settings?.admin?.siteVisibilitySettings?.shop_permalink;
|
||||||
?.shop_permalink +
|
if ( shopPermalink ) {
|
||||||
'?woo-share=' +
|
urlObject.href = shopPermalink;
|
||||||
shareKey
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return window?.wcSettings?.homeUrl + '?woo-share=' + shareKey;
|
const params = new URLSearchParams( urlObject.search );
|
||||||
|
params.set( 'woo-share', shareKey );
|
||||||
|
urlObject.search = params.toString();
|
||||||
|
|
||||||
|
return urlObject.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
const copyClipboardRef = useCopyToClipboard( getPrivateLink, () => {
|
const copyClipboardRef = useCopyToClipboard( getPrivateLink, () => {
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: fix
|
||||||
|
|
||||||
|
Fix LYS private link URL parameter regardless of permalink settings
|
Loading…
Reference in New Issue