Woocommerce为您的cat / checkout排除类别添加附加费

时间:2015-10-20 18:25:49

标签: php wordpress woocommerce cart

我正在使用Woocommerce的一个片段,它会为购物车的总金额增加一笔附加费。 我想知道是否有办法排除某个产品类别或失败,产品?

我正在使用的代码是:

public partial class MainWindow : Window
    {
        public static List<SignalRounding> SignalR;

        public MainWindow()
        {
            InitializeComponent();
            SignalR = new List<SignalRounding>();

            var r = SignalR.Where(t => t.time >= DateTime.Now.AddMinutes(-10))
            .GroupBy(g => g.symbol)
            .Select(s => new
            {
                Symbol = s.Key,
                Quantity = s.Count(),
                LastUpdated = s.Max(x => x.time),
                Price = s.Single(l => l.time == s.Max(x => x.time)).price,
                Round = s.Single(l => l.time == s.Max(x => x.time)).round
            })
            .OrderByDescending(x => x.LastUpdated)
            .ThenByDescending(x => x.Quantity);

            addStuff();

            lv.ItemsSource = r;
        }

        private void addStuff()
        {
            for (int i = 0; i < 15; i++)
            {
                SignalR.Insert(0, new SignalRounding()
                {
                    time = DateTime.Now,
                    symbol = i % 10 == 0 ? "second" : i % 5 == 0 ? "third" : "first",
                    price = 0.25 * i,
                    round = i
                });
                Thread.Sleep(500);
            }
        }
    }


    public class SignalRounding
    {
        public DateTime time { get; set; }
        public string symbol { get; set; }
        public double price { get; set; }
        public double round { get; set; }
    }

https://wordpress.org/plugins/woocommerce/

0 个答案:

没有答案