• Resolved cmgcomunicazione

    (@cmgcomunicazione)


    I have tried many ways to insert the price of the product created with woocommerce in a CF7 form, the last solution is to retrieve it in the database, I would like to understand how to do this

    currently I have tried with CF7 Data Source and I am writing the script, only this script needs a product selection, I need the price to be called without having to select a product from a list

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @cmgcomunicazione

    Thank you very much for using our plugin. You can pass the product id directly through the query.

    For example, assuming your product’s id is 123, you can use the tags structure similar to:

    <label> Product Price [text price] </label>
    
    [cf7-recordset id="product-price" type="database" query="SELECT meta_value as price FROM {wpdb.postmeta} WHERE meta_key='_price' AND post_id=123"]
    
    [cf7-link-field recordset="product-price" field="price" value="price"]

    If you want to insert the form into any product and get its id (product id), the tags structure above can be edited as follows:

    <label> Product Price [text price] </label>
    
    [cf7-recordset id="product-price" type="database" query="SELECT meta_value as price FROM {wpdb.postmeta} WHERE meta_key='_price' AND post_id={post.id}"]
    
    [cf7-link-field recordset="product-price" field="price" value="price"]

    Best regards.

    Thread Starter cmgcomunicazione

    (@cmgcomunicazione)

    Perfect thanks you so mutch

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get Product price CF7 data source’ is closed to new replies.