Woocommerce: how to update an order programmatically - wordpress

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?

Related

WooCommerce Flexible Checkout Fields Price Change

I'm using Flexible Checkout Fields plugin with wooCommerce. I have a select field where the user selects a number of attendees and 1, 2, or 3 team players. Each player option has a price. IF the user has a membership I want to override the player price and set it to 0. I was trying to do this with FCF Field validation with no luck. If you're wondering, the product in question has a base price everyone is charged, so using membership discounts won't work in the product. I thought about changing it to a variable product, but that started getting really messy as a user may have 3 attending, but only 1 or 2 playing. The simplest approach seemed to be just to validate the player fee based on membership and number chosen.
FCF validation number filter.

Wordpress Woocommerce Sorting

I'm looking for a way to sort the products in our website via most sales (popularity) but I also want to push a few specific and newer products to the top because otherwise it takes ages for users to find them.
There are the two following options
custom/default order
popularity
The issue is that with the custom/default option, it sorts all products that don't have a set priority by the alphabet and not by sales.
Is there a way to use the default sorting but use the popularity sorting unless a priority is set?

Woocommerce Subscriptions and synced force sell doesn't work?

I'm trying to create a situation in which a guarantee (no VAT) is automatically added to the cart when you order a variable subscription product. This should be done only one with the first transaction, not with the next payment in the subscription, therefore a grouped product construction.
I try to do this with the plugins mentioned above, but it simply doesn't appear in the shopping cart.
Any idea why and how to fix it?
For the grouped product, see also: https://www.rentyourmac.com/product/the-master-macbook-test-subscription/

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.

Change product currency and price in ubercart-based drupal with variable price

I run a donation site in Drupal, that soon needs to expand to another country, and will need to support not only switch of language, but also currency. The thing is, users donate money to charity in their own currency, and this needs to be summed up to a total amount of donations shown to the current user in their own currency.
A fundraiser is an ubercart product that users "buy" at a variable price, thus making a donation. I am creating a custom Donation node with each ubercart purchase containing CCK fields such as the amount donated.
So what I need to allow is this:
A user makes a donation in, say, Euro, EUR
Another user makes a donation in Danish Kroner, DKK
A third user views the site in US locale and should see all the donations converted to USD based off of the exchange rate at the time of donation for all the donations.
And it gets a little more difficult: We are using the UC variable price module to allow users to donate any amount they see fit.
So can this be accomplished using Drupal and Ubercart, and if so, how?
I am afraid that you will end up writing your own plug-in to convert currencies.
The problem with the conversion is, this is something that changes but you already realized this. The only source of exchange rates I know is Oanda and they seem to have their own Data Feed.
Unfortunately, I cannot tell if you would be allowed to use it for free, I believe it would be good to ask them.

Resources