# Existing product store and wix-code

**URL:** <https://forum.wixstudio.com/t/existing-product-store-and-wix-code/14906>\
**Category:** Ask the community\
**Tags:** question, code, wix-stores\
**Created:** [December 7, 2017, 11:48am UTC](https://forum.wixstudio.com/t/existing-product-store-and-wix-code/14906 "2017-12-07T11:48:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![museusmusic](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/museusmusic/32/1168_2.png) [@museusmusic](https://forum.wixstudio.com/u/museusmusic)\
**Post date:** [December 7, 2017, 11:48am UTC](https://forum.wixstudio.com/t/existing-product-store-and-wix-code/14906/1 "2017-12-07T11:48:24Z")

</div>

Hi to all,

We have:  
**Existing** Wix site with some products and the classic ‘product-page’ dynamic type url.  
e.g. https:// domain-name/product-page/productname1  
https:// domain-name/product-page/productname2.

Is it possible to use (on the product-page) wix-code and get the above url or the ‘productnameN’?  
Getting the url or productname of existing wix-store products will allow to add more js add-ons, reviews and allow to have a hybrid wix-store and wix-code.  
dim.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/system/32/86885_2.png) [@system](https://forum.wixstudio.com/u/system)\
**Post date:** [December 7, 2017, 2:57pm UTC](https://forum.wixstudio.com/t/existing-product-store-and-wix-code/14906/2 "2017-12-07T14:57:29Z")

</div>

Hi!

Can you try to use ’ [wixLoaction](https://www.wix.com/code/reference/wix-location.html) ’ module for that?  
see there [wixLocation.path](https://www.wix.com/code/reference/wix-location.html#path) .

Liran.

---

<div class="post-metadata">

**Author:** ![museusmusic](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/museusmusic/32/1168_2.png) [@museusmusic](https://forum.wixstudio.com/u/museusmusic)\
**Post date:** [December 7, 2017, 3:05pm UTC](https://forum.wixstudio.com/t/existing-product-store-and-wix-code/14906/3 "2017-12-07T15:05:46Z")

</div>

Hi Liran,  
i already try (wix location path, url etc) but I only get the url "https:// domain-name/product-page/ " and not the last part which is the one that changes and of course the significant one . (note that to test, I use a free published site copy of the premium).  
dim.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/system/32/86885_2.png) [@system](https://forum.wixstudio.com/u/system)\
**Post date:** [December 7, 2017, 3:14pm UTC](https://forum.wixstudio.com/t/existing-product-store-and-wix-code/14906/4 "2017-12-07T15:14:39Z")

</div>

OK,

I suspected that this will be the case… unfortunately this is the only option for now.  
We’ll have a deeper look at that and keep you updated.

Liran.

---

<div class="post-metadata">

**Author:** ![museusmusic](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/museusmusic/32/1168_2.png) [@museusmusic](https://forum.wixstudio.com/u/museusmusic)\
**Post date:** [December 7, 2017, 3:16pm UTC](https://forum.wixstudio.com/t/existing-product-store-and-wix-code/14906/5 "2017-12-07T15:16:39Z")

</div>

Ok Liran  
Thanks.

---

<div class="post-metadata">

**Author:** ![alfredo-lavin](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/alfredo-lavin/32/1467_2.png) [@alfredo-lavin](https://forum.wixstudio.com/u/alfredo-lavin)\
**Post date:** [January 8, 2018, 8:28pm UTC](https://forum.wixstudio.com/t/existing-product-store-and-wix-code/14906/6 "2018-01-08T20:28:17Z")

</div>

hi to all

The same thing happens to me, I would like to capture the whole URL, I leave my code, if you can help me, I would appreciate it

import wixLocation from ‘wix-location’;

$w.onReady(function () {  
let url = wixLocation.url; // Change wixLocation.protocol to wixLocation.url. Should be in $w.onReady scope  
$w(“#URLcurrent”).value = url; // #URLcurrent represents the id name of your input field, change it to the correct id name  
$w(“#dataset1”).onAfterSave(sendFormData);  
});

import {sendEmail, sendEmailWithRecipient} from ‘backend/email’;

$w.onReady(function () {  
$w(“#dataset1”).onAfterSave(sendFormData);  
});

function sendFormData() {  
const subject = `A ${$w("#input2").value} LE INTERESA LO SIGUIENTE:`;  
const body = `Formulario de inscripción ME INTERESA

\URL: ${$w(“#URLcurrent”).value}  
\Nombre: ${$w(“#input2”).value}  
\Teléfono: ${$w(“#input3”).value}  
\Email: ${$w(“#input4”).value}  
\Terreno: ${$w(“#selection1”).value}`;

const recipient = $w(“#input2”).value;  
sendEmailWithRecipient(subject, body, recipient)  
.then(response =\> console.log(response));

sendEmail(subject, body)  
.then(response =\> console.log(response));  
}

 ![](https://us1.discourse-cdn.com/wix/original/3X/5/0/5094694b56c38456c88e8987a830913729768abb.jpeg)

---

<div class="post-metadata">

**Author:** ![museusmusic](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/museusmusic/32/1168_2.png) [@museusmusic](https://forum.wixstudio.com/u/museusmusic)\
**Post date:** [January 9, 2018, 8:10pm UTC](https://forum.wixstudio.com/t/existing-product-store-and-wix-code/14906/7 "2018-01-09T20:10:46Z")

</div>

Hi Alfredo,  
(I am not a WIX staff)

To get the url, I worked with this solution :

(1) add an html component to page (with name : html3)

(2) add code to the html component :

```javascript
<script type="text/javascript" src="//static.parastorage.com/services/js-sdk/1.90.0/js/wix.min.js"></script>
<script>
var HTMLurl;
document.addEventListener("DOMContentLoaded", function(event) {
	Wix.Settings.getSiteInfo(function (siteInfo) { HTMLurl = siteInfo.url;
window.parent.postMessage(HTMLurl, "*");
  });
  });
</script>

```

(3) add code to page

```javascript
import wixWindow from 'wix-window';
var pUrl;

$w.onReady(function () {	
		$w("#html3").postMessage("");
		Init();
} );

export function Init() {				
	$w("#html3").onMessage( (event) => {		
		pUrl=event.data;
		console.log("pUrl " + pUrl);	
	});
}

```

(4) On PUBLISHED site, I have the URL in pUrl variable.

Dim.

---

<div class="post-metadata">

**Author:** ![alfredo-lavin](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/alfredo-lavin/32/1467_2.png) [@alfredo-lavin](https://forum.wixstudio.com/u/alfredo-lavin)\
**Post date:** [January 9, 2018, 8:55pm UTC](https://forum.wixstudio.com/t/existing-product-store-and-wix-code/14906/8 "2018-01-09T20:55:56Z")

</div>

hi Museusmusic

your method worked for me, finally, you passed, I’ve been trying to capture the complete url for a long time and I see that you had the same problem, thanks for sharing your knowledge and thanks to everyone who also helped me in the forum.

thank you very much to all

 ![](https://us1.discourse-cdn.com/wix/original/3X/4/e/4e388586a58c8a9dd046fec06fd760472b09b936.jpeg)

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/system/32/86885_2.png) [@system](https://forum.wixstudio.com/u/system)\
**Post date:** [January 10, 2018, 9:12am UTC](https://forum.wixstudio.com/t/existing-product-store-and-wix-code/14906/9 "2018-01-10T09:12:26Z")

</div>

Hi Guys, we know this and we’re working on a fix.  
Thanks,  
Liran.

---

<div class="post-metadata">

**Author:** ![alfredo-lavin](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/alfredo-lavin/32/1467_2.png) [@alfredo-lavin](https://forum.wixstudio.com/u/alfredo-lavin)\
**Post date:** [January 11, 2018, 3:37pm UTC](https://forum.wixstudio.com/t/existing-product-store-and-wix-code/14906/10 "2018-01-11T15:37:23Z")

</div>

hi to all  
I can not send the data of ¨pUrl¨ to the database, the database does not save anything  
help me please
