简体   繁体   English

Woocommerce可变产品未添加到购物车

[英]Woocommerce Variable Products not adding to the Cart

Hi Everyone i am using a woocommerce website. 大家好,我正在使用woocommerce网站。 I have added different products on my website. 我在网站上添加了其他产品。 Some of them are single and some of them are variable. 其中有些是单身的,有些是可变的。 Single products are working fine. 单一产品运行良好。 Now the issue is when i open up a variable product and tries to add into the cart i am getting an error "Please choose product options…" although i already selected an option of that product. 现在的问题是,当我打开可变产品并尝试将其添加到购物车中时,尽管我已经选择了该产品的一个选项,但是却收到错误消息“请选择产品选项...”。 When i open up the console i found this error 当我打开控制台时,我发现此错误

ReferenceError: wp is not defined


...=!1,j=!1,k=c.find(".reset_variations"),l=wp.template("variation-template"),m=wp....

The file referencing to this error is add-to-cart-variation.min.js which is located inside the woocommerce plugin folder. 涉及此错误的文件是add-to-cart-variation.min.js,该文件位于woocommerce插件文件夹中。 I have searched allot and tried different things but could not find out the result. 我已经搜索了分配,并尝试了其他方法,但找不到结果。 I have also tried disabling all the plugins and but error still remain. 我也尝试禁用所有插件,但错误仍然存​​在。 Please Help me out on this. 请帮我解决这个问题。

To solve this issue you can apply a simple jquery fix: 要解决此问题,您可以应用一个简单的jquery修复程序:

Add the below code in function.php 在function.php中添加以下代码

if ( ! is_admin() ) {

add_action( 'wp_enqueue_scripts', 'woocommerce_jquery_cookie_script' );

function woocommerce_jquery_cookie_script() {

    // deregister script
    wp_deregister_script( 'jquery-cookie' ); 

    $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';

    wp_register_script( 'jquery-cookie', plugins_url( 'jquery_cookie' . $suffix . '.js', __FILE__ ), array( 'jquery' ), '1.3.1', true );



}

}

and the 2 js file can be download from the below link: 并且可以从以下链接下载2 js文件:

https://support.woothemes.com/hc/en-us/article_attachments/200746747/woocommerce-jquery-cookie-fix.zip https://support.woothemes.com/hc/zh-CN/article_attachments/200746747/woocommerce-jquery-cookie-fix.zip

Hope that helps! 希望有帮助!

暂无
暂无

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

相关问题 隐藏WooCommerce变量产品上的“添加到购物车”按钮 - Hiding 'Add to Cart' button on WooCommerce variable products 添加到购物车并重定向到 WooCommerce 中可变产品的结帐 - Add to cart and redirect to checkout for variable products in WooCommerce 在将产品添加到购物车后,woocommerce显示购物车在firefox中是空的 - woocommerce shows cart is empty in firefox,after adding the products to cart 在 WooCommerce 中添加到购物车特定产品之前清空购物车 - Empty cart before adding to cart specific products in WooCommerce Ajax 加入购物车 WooCommerce 单品上的简单和可变产品 - Ajax Add to cart for simple and variable products on WooCommerce single products 自动将产品添加到购物车时排除某些类别 WooCommerce - Exclude certain categories when automatically adding products to the cart WooCommerce 使用 SKU 和 URL 参数一次将多个产品添加到 WooCommerce 购物车 - Adding multiple products to WooCommerce cart at once with SKU and URL parameters 使用 ACF 在 WooCommerce 购物车中为可变产品获取自定义字段 - Get a custom field in WooCommerce cart for variable products too using ACF 添加到购物车并重定向到 WooCommerce 中默认可变产品的结帐 - Add to cart and redirect to checkout for default variable products in WooCommerce WooCommerce AJAX放入购物车以获取可变产品,仍重定向到产品页面 - WooCommerce AJAX Add to Cart for Variable products, still redirecting to product page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM