WooCommerce Subscriptions: Discounts according to length of subscriptions - php

I have WooCommerce Subscriptions and Discounts for WooCommerce Subscriptions which allows me to offer discounts according to the number of renewals.
However I can't find any plugin or method that allows me to offer the same subscription with different lengths (with discounts if the length exceeds a certain number of months).
For example:
3 months: -10%
6 months: -20%
12 months: -30%
It's currently impossible for a customer to buy multiple months of a subscription at once.
Do you know any solution ?
Thanks!

Maybe it'd be easier to just use a variable subscription?
https://woocommerce.com/document/subscriptions/store-manager-guide/#section-6

Related

How to calculate shipping cost based on Woocommerce booking time slots?

I have a woocommerce shop with the woocommerce booking system. At my website, you can book meal deliveries based on time slots. I used the booking system because some meals are available some days. And, you can book meals on multiple days in one order.
My problem is that I want to apply a fixed shipping cost (3,5euros) based on deliveries/time slots. I can’t group meals of the same delivery in one order.
My question is : is there a way to make a php script to calculate shipping cost based on delivery time slots?
My current cart page and what i need
currently, i use this calculation method on woocommerce settings : 3,5 * [qty]
The problem in my case is that don't want to charge multiple times for the same delivery.
Thank you!

Woocommerce Cart: Override or filter get_cart_item_quantities()

For the products in a cake shop, the cakes can get ordered for different order dates (order attribute) within the same order.
The stock should only be considered, if the cakes are ordered for the next day. For orders further in the future, the stock is irrelevant.
So I want to modify the cart that in get_cart_item_quantities() the item quantities get only grouped for cakes ordered for the next day.
So far, I managed to write a plugin extending the original cart and overriding get_cart_item_quantities()and add_to_cart().
But with the recent update, the plugin is no longer working due to new class hierarchies.
So I'm looking for a solution with standard filters and actions which is more update proof.
Can anyone help?
Here's more information on what I want to achieve:
The cakes can be ordered as a whole cake (12 or 16 pieces) – which is the main product – or as a variation of a quarter cake (3 or 4 pieces).
The shop keeper wants to manage the stock in number of pieces for the whole cake, not with the variations as well.
Moreover, the cakes can be ordered for next day delivery or sometime in the further future.
ONLY if the cake gets ordered for the next day, the stock should get checked.
Let's say there is 12 pieces of a cake in stock.
One customer buys a whole cake (12 pieces in this case) for tomorrow and a quarter for sometime next week.
When adding this to the cart, the cart should contain:
amount 1 of the whole cake for tomorrow
amount 1 of the quarter cake for sometime later
I add the delivery date in woocommerce_add_cart_item_data.
Internally, WC_Product::has_enough_stock() should check the stock only for the items ordered for tomorrow and in the actual number of pieces, in this case 12 for the whole cake for tomorrow (even though the amount in the cart is 1)
So far, I implemented the number of pieces by overriding WC_Cart::get_cart_item_quantities() and adding a custom filter.
And by overriding WC_Cart::add_to_cart() to modify has_enough_stock().
During checkout, I reduce the stock amount by the correct number of pieces by filtering woocommerce_order_item_quantity.
But of course, with the plugin solution I need to update the plugin with almost every update of WooCommerce.
The possibilities I see at the moment:
As WC_Product::has_enough_stock() is not applying any filters itself, I could filter woocommerce_product_variation_get_stock_quantity and return the actual quantity if the delivery date is relevant and return a fake number like 9999 in all other cases.
Like this, stock management should workg during add to cart, in the cart and during checkout when relevant.
What do you think?

How to build a monthly subscription with Stripe?

I am working with Stripe subscription and I don't want to create different plans with xy users included but set the price simple to 10$ per user per month. See the pricing at https://www.box.com/en_GB/pricing/ to get an idea what I mean.
How can i realize that subscription behavior in Stripe? Do I need to create an own plan for every count of users? (eg. oneuserplan 10$, twouserplan 20$, threeuserplan 30$,.....)
Or can I somehow multiply the 10$/month base subscription with with the count of users?
You can find a quantity field in stripe documentation
The quantity you'd like to apply to the subscription you're creating.
For example, if your plan is $10/user/month, and your customer has 5
users, you could pass 5 as the quantity to have the customer charged
$50 (5 x $10) monthly....

Different shipping amounts based on total amount of order in ubercart

is there an option to offer different shipping amounts based on the total amount of the order in Ubercart ? An example would be the following, if the order totaled:
0-$50 then shipping would be $50
$50-$100 then shipping would be $125
$100-$500 then shipping would be $1000
I don't think there is any specific option for that, but in MARKUPS you can choose the percentage, which may give a close result of what you need.

Ubercart - Product discount based on total number of all products in cart

I'm using Ubercart in Drupal for a simple web store. I'm having trouble calculating a product discount based on the total number of all products in the cart. For example, I'm easily able to define discounts for if a user buys more than one of the same product, using the uc_custom_price module. But I want to give the discount if they buy more than one of any product. If they buy item 1 for 10 dollars and then add item 2 for 10 dollars, then I want both items to now cost 8 dollars.
Hopefully this makes sense. I searched the forums and googled for a couple of hours, but I just can't get this to work correctly. Thanks for your help.
Check Rules + Ubercart module. Or write custom code on order creation

Categories