Cloudfront + Woocommerce-购物车未更新 [英] Cloudfront + Woocommerce - cart not updating

查看:63
本文介绍了Cloudfront + Woocommerce-购物车未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将Cloudfront添加到了托管在AWS上的wordpress网站中.

I have recently added cloudfront to my wordpress site hosted on AWS.

起初,我的购物车不会注册添加到其中的任何产品-因此我在Cloudfront进行了一项行为,即不缓存购物车,我的帐户和结帐页面.

At first my cart would not register any products being added to it - so I made a behaviour in cloudfront to not cache the cart, my account and checkout pages.

现在我的用户一次只能添加一个产品-添加一秒钟后,它会覆盖最初添加的内容.

Now my users can only add a single product at a time - after adding a second it overwrites what was added in intially.

我相信Cloudfront的缓存行为一定是有问题的.谁能帮助我,让woocommerce与Cloudfront搭配使用需要什么设置?

I believe it must be a problem with the caching behaviour of cloudfront. can anyone help me with what settings I need to get woocommerce to play nice with cloudfront?

这是我的设置:

推荐答案

这就是我用来解决此问题的方法.我使用AWS wordpress插件设置了Cloudfront.它为我创建了具有5种不同行为"的分布.通过登录AWS CloudFront控制台并导航到您的分发设置中的行为"选项卡,可以发现这些行为.

This is what I used to fix the issue. I set up Cloudfront using the AWS wordpress plugin. It created a distribution for me with 5 different "behaviours". These behaviours are found by logging into the AWS CloudFront console and navigating to the "behavious' tab in your distribution settings.

此处是分步说明.转到Cloudfront.查找您的分布.单击ID或单击复选框,然后打开设置.找到行为"标签并打开.您应该有一个默认( * )"那里的行为.打开并编辑该行为.添加"wp_woocommerce_session_ *"到白名单Cookie"框中,然后点击是,修改"在页面底部更新.更改应立即生效.

Here are step by step instructions. Go to Cloudfront. Find your distribution. Click on the ID or click the checkbox and open the settings. Find the 'behaviors' tab and open in. You should have a "default(*)" behavior in there. Open and edit that behavior. Add "wp_woocommerce_session_*" to the 'Whitelist Cookies' box and the click, "Yes, Edit" to update at the bottom of the page. Changes should take effect immediately.

您也可能希望将这些cookie列入白名单:

You will also likely want to whitelist these cookies as well:

woocommerce_items_in_cart*
woocommerce_cart_hash*
woocommerce_recently_viewed*
wp-resetpass* (for WP password resets)

您可以在此处了解有关 Woocommerce Cookie的更多信息:

You can read more about Woocommerce cookies here:

这篇关于Cloudfront + Woocommerce-购物车未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆