download product price

Posted by: carlo fattori

22nd June 2022, 9:32 am

carlo fattori

@carlo_fattori

22 Jun 2022
9:32 am

Hello,

I wanted to submit a case study: I start from my need to be able to know the cost of downloaded products (with free download pro plugin).

Step1: I create a simple product "a1" with price 100.

in wp_postmeta, records are normally created, including the record with

post_id=<xxx>, meta_key="_price" and "meta_value=100.

Step2: I make a product download. records are correctly inserted in postmeta including the record with

meta_key="somdn_product_id",meta_value=<xxx>.

in the records added now there is not a record with meta_key="_price" but I can know the download price by pointing to the product record through the somdn_product_id ( <xxx>)

Step3: Now suppose you vary the product by making it a variable product through an attribute with 2 variations.

records will be created for each variation in postmeta. in each of them a record with the price will be reported.

New postmeta records will also be added with post_id=<xxx>, meta_key="_price", and meta_value

about the prices of the changes created.

now I can no longer understand the price of the downloaded products in the product download when the product was of the simple type.

this is because in its record the prices of the variations have also been added.

I do not know if I have been clear and / or I have said inaccuracies. In case the problem was real I would suggest to add at least the price of the downloaded product in the records postmeta inserted at the time of download.

this would protect against any changes to the history of the product.

  • Developer
    Richard Webster

    @rwebster

    22 Jun 2022
    10:46 am

    Hi mate. Price was not factored into the tracked download post because the price to the customer is considered free.

  • carlo fattori

    @carlo_fattori

    22 Jun 2022
    11:22 am

    I understand the answer. maybe before continuing I try to describe my need that I thought to solve with the free download plugin:
    I should implement an accounting logic as follows: a company x has a number of clients. Each customer can download over time products that have a cost without going through checkout. According to variable agreements (reaching a threshold, reaching the number of downloads, etc ..) and not easily implementable through plugins (at least I have not found any) the company will be sent a report with the sum of the downloads made (number of downloads, sum of amounts,...).
    The company will then proceed to payment.
    I was thinking of implementing the accounting logic with an external application (filemaker) through a link ODBC to the worsdpress db.
    As said I understand your (logical) answer. I would only suggest that it would perhaps have been useful to insert an option with which to ask for the inclusion of the price in the configuration of the tracking section of the plugin. there is already an option with which you are asked to enable free download even to discounted products and I think this option could be useful.
    If this is not possible I will find some workarounds.

    thanks anyway for the quick answers

  • Developer
    Richard Webster

    @rwebster

    22 Jun 2022
    11:37 am

    Hi mate, I understand. Adding the price to the meta data is possible. I will give you a code snippet tomorrow 🙂