需要基于ip country的std代码作为woocommerce结帐领域的电话字段的前缀

时间:2018-01-10 12:33:31

标签: woocommerce ip checkout billing

https://dev.clipcertification.com/checkout/

我希望使用基于ip country的电话字段为std代码添加前缀,例如:如果用户的ip国家是印度,则会在Phone之前显示一个字段,显示+91,依此类推。

如何实现?请帮忙

1 个答案:

答案 0 :(得分:0)

我不确定您是否正在寻找此项,但如果您想为尊重的国家/地区显示billing_phone的默认值。你可以尝试这段代码。

var hello = new Blob(["alert('hello')"], {type:'application/javascript'});
var script = document.createElement('script');
script.src = URL.createObjectURL(hello) + '#hello.js';
document.head.appendChild(script);
console.log(script.src);

var css = new Blob(["body{background:red}"], {type:'text/css'});
var style = document.createElement('link');
style.href = URL.createObjectURL(css) + '#style.css';
style.rel = 'stylesheet';
document.head.appendChild(style);
console.log(style.href);
相关问题