简体   繁体   English

Shopify购买按钮未显示在手机上

[英]Shopify buy buttons not showing on mobile

I have some shopify Buy buttons on my website. 我的网站上有一些shopify购买按钮。 They show fine on desktop browsers - the site is responsive and the buttons show on all viewport queries on desktop browsers. 它们在桌面浏览器上可以正常显示-该​​网站具有响应能力,并且按钮在桌面浏览器上的所有视口查询中显示。

When viewing the site on mobile I get no buy buttons. 在移动设备上查看网站时,我没有购买按钮。 I thought it may be a cross-origin issue so I hosted the shopify javascript files locally and I get the same behaviour. 我认为这可能是跨域问题,因此我在本地托管shopify javascript文件,并且得到了相同的行为。

I have tried all the different versions of the buy now button and I get the same behaviour. 我尝试了“立即购买”按钮的所有不同版本,并且得到了相同的行为。

Is there a reason I can't see buy buttons on mobile? 我在手机上看不到购买按钮是有原因的吗? Site is www.redlamp.com.au/myriad/shopify2.html 网站是www.redlamp.com.au/myriad/shopify2.html

There is an error in the shopify code buy-button-storefront.min.js:7 TypeError: Failed to execute 'fetch' on 'Window': Invalid value(…) shopify代码中的错误buy-button-storefront.min.js:7 TypeError: Failed to execute 'fetch' on 'Window': Invalid value(…)

It seems that fetch is not available on your Android device see more info here . 似乎无法在您的Android设备上进行抓取 ,请参见此处的更多信息

Try to add a polyfill like that one before running the Shopify code. 在运行Shopify代码之前尝试添加类似的polyfill。

or maybe there is really an error on their sides. 也许他们这边确实有错误。 You can address the problem on their GitHub repo 您可以在他们的GitHub存储库上解决问题

I found the culprit - I had extended the Object with my own rudimentary add/remove class functions. 我找到了罪魁祸首-我已经用我自己的基本添加/删除类函数扩展了Object。 Removing the following code fixed the problem: 删除以下代码可解决此问题:

Object.prototype.addClass = function(clas) {        

    if (this.classList)
        this.classList.add(clas);
    else
        this.className += ' ' + clas;

}

Object.prototype.remClass = function(clas) {        

    if (this.classList)
        this.classList.remove(clas);
    else
        return;
}

Thanks! 谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM