• sasamen

    (@dariodacierno)


    Hello there, I would like to buy your plugin but I have a request:

    Can I setup different costs for a simple product? For i.e.: When a product is on sale it has a different cost (only for the limited time of the sale). Then it goes back on a normal cost.

    This should be historically saved in reports too. What do you suggest?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Algoritmika

    (@algoritmika)

    Hi @dariodacierno,

    Generally, after new order is created and cost is transferred from the product to the order item, you can manually change it on the order edit page. As I understand you want to make it automatic, correct? I’m not sure if adding a separate cost for products on sale is a good idea (as the task sounds rather unique), however, I’m thinking that I could add a filter for that, so you would need to add a small PHP snippet. Would that be good enough (I will give you an example of the snippet)?

    Thread Starter sasamen

    (@dariodacierno)

    Hello there, thanks for the fast reply.
    Yes, the scenario is like this:
    I sell a product for a regular price of 10$, paying the item 9$. My profit is 1$.

    If the product doesn’t sell, I go for a flash sale price, asking the producer for a discount.

    Let’s say that the new flash sale price is 8$ and I ask the producer to lower the cost of the item to 6$. My profit is now 2$ for the time being it in sales.

    When the flash sale ends, the item goes back to the normal price of 10$ and the cost is raised back to the inital cost of 8$.

    It’s a very common scenario or return-sale goods, where the producer gets paid only if the item is sold.

    My question is: I could also go for the MANUAL CHANGE, but does the plugin keeps the history of the change, so that my Profit&Loss Report reflects those changes?

    Thanks a lot in advance!

    Plugin Author Algoritmika

    (@algoritmika)

    @dariodacierno,

    Yes, when you update item costs in order, then order total cost and profit are updated, and this will be reflected in reports.

    Alternatively, instead of modifying item costs in order, you can change product cost and it will be reflected in all future orders, until you change product cost back to the original.

    In other words – when new order is made, plugin takes current product cost and saves it in order. If you change product cost later (on product edit page), it won’t affect the cost/profit of older orders, only future orders will be affected. Hope you get the idea…

    So I believe your workflow would look like this:

    1. Product is not on sale – you set product price to $10, and cost to $9.
    2. You set product on sale – you set product price to $8, and cost to $6.
    3. You remove sale from product – you set product price back to $10, and cost back to $9.

    All this will be reflected in reports.

    P.S. If you will be changing product costs, do not run “Recalculate orders cost and profit for all orders” tool (in “WooCommerce > Settings > Cost of Goods > Tools & Reports”), as it will replace all orders items costs with current product costs.

    Hope that clears it up. Please let me know if you have any questions.

    • This reply was modified 4 years, 5 months ago by Algoritmika.
    Thread Starter sasamen

    (@dariodacierno)

    Hi there, we are using the PRO version of your plugin with excellent results!

    Just one kind request: could you please add a separate cost of goods for when items are on sale? Or create a scheduler for changing cost of goods based on dates?

    We are currently MANUALLY changing the costs everytime we go on a sale for a product ??

    P.S. We are still at 1.7.2, but I’ve read you have released 2.0. Why it won’t show up?

    Plugin Author Algoritmika

    (@algoritmika)

    Hi @dariodacierno,

    Sorry for the late reply.

    Would it be acceptable for you to add a small PHP snippet for your task? If yes, I could add a filter for product cost. So you would need to add something like this (e.g. to your (child) theme’s functions.php file):

    
    add_action( 'alg_wc_cog_get_product_cost', 'my_alg_wc_cog_get_product_cost', 10, 2 );
    if ( ! function_exists( 'my_alg_wc_cog_get_product_cost' ) ) {
        /**
         * my_alg_wc_cog_get_product_cost.
         */
        function my_alg_wc_cog_get_product_cost( $cost, $product_id ) {
            $product = wc_get_product( $product_id );
            if ( $product->is_on_sale() ) {
                switch ( $product->get_id() ) {
                    case 113:
                    case 114:
                        return 50.49;
                    case 150:
                        return 55.99;
                    // TODO: here you can list more costs, in "case product_id: return cost_when_on_sale;" format
                }
            }
            return $cost;
        }
    }
    

    * this is not done yet… just an idea, but I could quickly add it to the plugin.

    Regarding why new version is not showing up – if you are referring to a Pro version, you have two options:

    Hope that helps. Please let me know if you have any questions.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Need to have variable costs on same item’ is closed to new replies.