Bigcommerce 添加到购物车弹出窗口

gBa*_*ard 3 bigcommerce

之前使用bigcommerce时,我们可以选择是否在用户单击“添加到购物车”按钮时弹出窗口或将用户带到购物车。有谁知道 BigCommerce 是否已删除此功能或者我现在可以在哪里找到该设置?谢谢你!

小智 5

您知道您使用的是 Stencil 还是 Blueprint 框架吗?

如果您使用蓝图,则可以转到“商店设置 > 商店设置 > 显示”,然后选择“将他们带到购物车”。

如果您使用模板,该功能将被隐藏,您必须进行自定义才能使其工作。如果您的产品没有任何选项,您可以按照此页面上的说明进行操作:https ://support.bigcommerce.com/articles/Public/How-can-I-add-a-product-to-the-cart -with-a-link/#add-to-cart

但是,如果您有选项,这将不起作用,因为它不会更新 url 中的 sku。为了让它发挥作用,我所做的是编辑product-details.js

首先,您需要下载主题才能编辑 js 文件。然后,从 开始line 234,您将看到以下代码:

// Open preview modal and update content
if (this.previewModal) {
    this.previewModal.open();
    this.updateCartContent(this.previewModal, response.data.cart_item.hash);
} else {
    this.$overlay.show();
    // if no modal, redirect to the cart page
    this.redirectTo(response.data.cart_item.cart_url || this.context.urls.cart);
}
Run Code Online (Sandbox Code Playgroud)

在注释的正下方添加 /*,然后在 else 语句 (}) 的右大括号下向下一行添加 */ 以结束长注释。代码现在看起来像这样:

// Open preview modal and update content
/*
if (this.previewModal) {
    this.previewModal.open();
    this.updateCartContent(this.previewModal, response.data.cart_item.hash);
} else {
    this.$overlay.show();
    // if no modal, redirect to the cart page
    this.redirectTo(response.data.cart_item.cart_url || this.context.urls.cart);
}
*/
this.redirectTo(response.data.cart_item.cart_url || this.context.urls.cart);
Run Code Online (Sandbox Code Playgroud)

让我知道这是否有帮助!