3
votes

I will try to explain what I need:

By default woocommerce allows to handle just 1 scheduled sale price per product, I need the possibility to add another one (for simple and variable products).

In other words, for each product I need to have 3 different prices, depending on the date the purchase is made. Also, in the product page I need to show ALWAYS the 3 prices and their relative scheduled period of time (even if it's in the past or future). Example:

Product #1

  • from 01-01-2014 to 01-31-2014 you pay € 100 (this is what I need)
  • from 02-01-2014 to 02-28-2014 you pay € 200 (scheduled woocommerce
  • sale price) from 03-01-2014 and after you pay € 300 (regular woocommerce price)

Product #2

  • from 01-01-2014 to 01-31-2014 you pay € 150 (this is what I need)
  • from 02-01-2014 to 02-28-2014 you pay € 280 (scheduled woocommerce sale price)
  • from 03-01-2014 and after you pay € 330 (regular woocommerce price)

etc...

Any suggestion on how to add this feature in a new plugin?

1

1 Answers

2
votes

You can easily customized these conditions using inner code on WooCoomerce. No need to use any extra plugin for the same. Following is the idea, how you can do that.. Hope this helps.

Having a look at the Product abstract class in WooCommerce the following php code gets whether or not the product is on sale:

return ($this->sale_price != $this->regular_price && $this->sale_price == $this->price);

Which seems to indicate that the _price has to be the same as the sale_price in order for it to be classed as on sale. So just

update_post_meta($id, '_price', 'new sale price here too');

you can edit this code as per your required conditions.