Applying second discount in Woocommerce - after bulk discount - wordpress

in my online store I have applied a bulk discount (i.e. a percentage reduction based on the quantity purchased). This works great. I also want to apply a second discount mechanism where the customer can select a criteria from a dropdown box and a discount will be applied again. This second category is schedule i.e. daily, weekly, monthly for a service - ie how often the service purchased will be delivered. This will reduce the unit price i.e. for one product.
I am not using a subscription method for this as the customer will be invoiced once a month - i.e. not based on which drop down (daily, weekly) the select.
Any suggestions would be greatly appreciated.

Related

Woocommerce and Gravity Forms problem with deliveries

It's been a week since I'm trying to resolve this, and I'm just stuck. Please help :)
Here is the problem: I have a website with catering services, that are delivered every day to the clients. It's done using wordpress, gravity forms + addons (woocommerce and perk plugins with calendar and conditional pricing) with complicated conditional logic as the meals have different calories and so on. It's only one product, but it's coming from Gravity Forms itself. The form is calculating the number of days as a hidden field and I want to calculate the delivery cost by multiplying the number of days, that the Client placed the order for by the flat rate cost of a particular delivery zone in woocommerce (3 zones with different delivery costs in total). Let's say the cost of the delivery to one City is $5 and the order is placed for 10 meals, meaning 10 deliveries with fresh meal every day - so I want the delivery cost to be $5*10 = $50 for that order. I tried to achieve this with Gravity Perks- not possible, with Woocommerce Addon for Gravity Forms- it's possible to override the number of items ordered, but not the delivery cost itself... and I'm out of ideas :(
Does anybody have any clue how to achieve this?
Huge Thanks and a big beer in advance :)

Woocommerce Analytics Revenue should be based on Paid date

I use Woocommerce to add orders from admin manually. Most of my clients pay after 15 to 90 days after order is created, in some cases longer than 90 days.
I notice that Woocommerce Analytics always shows revenue based on Order created date. I agree with it by one point of view as order was created on that day, so, the revenue belong there.
I think orders tab in Analytics shows it right, which is Date, Order, customer, amount, etc..
But I think Revenue should be based on order->get_paid_date() rather than created date as the money still comes in on the paid date. If Woocommerce changes the formula, it would make little to no difference for those whose orders are paid online immediately. And it will take care of those whose orders are paid later on.
Just curious, since logically Revenue is the money coming into account and Analytics>Orders tab shows Orders by created date well already.
Thanks for your input for me to understand how Woocommerce thinks.
Currently Woocommerce Analytics does not take paid date meta into account, it considers order creation date for revenue consideration.
It depends how one looks it, it's right and wrong.
For my use, where customers pay days or months later, it's wrong. but still the order was placed on the creation date, so, the revenue should still be linked to the creation date. so, it's right too.
One thing I did was from Analytics settings, I removed some custom status of the order to exclude from Analytics, that way until the order is actually either in Pending status or Completed status, it does not consider it in revenue. Not a perfect solution, but it helps me to exclude canceled and some custom status like Quotation not be included in Revenue.
I ended up programming my own custom admin page where I pulled all orders in completed status with paid date between start and end date and did the total manually to get my actual income for the year.
Just for someone else looking for similar question, it might help.

Woocommerce: how to update an order programmatically

Currently, my customers fill out a form which takes their measurements and then recommends a product variation specifically for their measurements. This is great, but takes time and is not always convenient for the customer.
I want to allow my customers to purchase a generic version of the product (so they pay immediately), submit their measurements at a later, more convenient date for them (e.g. through a form they fill out) and then update the purchased product to a specific variation with their measurements.
Is it possible to do this in Woocommerce? If so, how could I do this programmatically?

Aggregate events / goals per user

I would like to know if there's a way to display information based on how many (similar) goals or events were triggered by a unique user.
For instance, let's say I own amazon. For every product I sell, I trigger a 'Purchase' goal (by using an event).
I would like to know:
How many products does an average user buy, in multiple sessions, over a time span. for instance, how many products did an average user buy in the span of a month.
I would like to segment data by the amount of products bought by users. i.e. segmenting my data based on users that bought 0 products, 1-5 products, 6-10, products, and 11+ products.
Is there a way to do so?
You have to get custom dimension/metric in GA. Add a custom dimension 'product_quantity' and get actual number of products bought as metric value in the variable.
Once you get have it, you do calculation of total products divided by users or creating segments based on product_quantity dimension.
Find more info at https://support.google.com/analytics/answer/2709828?hl=en
It is easier with Google Tag Manager. Once you define custom dimension/metric, trigger may be completion of 'Purchase' goal or any event.

How to Calculate current Sales Price of item from Code (after evaluating all trade agreements and discount offers)

I need to develop a SSRS report which will list all items and their sales prices, some items have discount offers, some have trade agreements and some items have both applied on them, I am wondering if there is a built-in method which will return current sales price after taking all offers and trade agreements into account.
any code example would be much appreciated.
The logic for finding trade agreements is contained in class PriceDisc. It also has a fallback if no agreements exist.
On table InventTable there's a method salesPriceAgreement() which uses that class and might do just what you need or at least serve as an example of how to use the class.

Resources