Edit not updating custom fields
Author | Posts |
---|---|
October 27, 2013 at 6:04 am 9475 | |
bigtom | Hey, I've got wpuf creating products in woocommerce and it works a treat! The only thing is when creating or editing a product post I need to go to the product in the wordpress admin and publish it to get the pricing data to show up. The data is getting passed correctly as the woocommerce Regular Price (_regular_price) and Sale Price (_sale_price) fields are populated by the wpuf form. Any idea what I might explore for a fix? Thanks in advance for any help provided and awesome plugin :) |
October 27, 2013 at 10:06 am 9478 | |
Tareq Hasan | The right meta key should be |
October 27, 2013 at 2:16 pm 9480 | |
pasturesmoo | There isn’t a price field anymore in the woocommerce backend product view. Only Regular Price and Sale Price. The form does work it just doesn’t register the prices until opened and saved in the wp admin. |
October 27, 2013 at 9:53 pm 9483 | |
Tareq Hasan | I know the label in the product page is Regular Price and Sale price, but still when using the single price, it uses the |
October 27, 2013 at 10:16 pm 9485 | |
pasturesmoo | Yeah I’ve tried
Thanks |
October 29, 2013 at 4:55 pm 9562 | |
pasturesmoo | When creating a new product directly in the admin here’s the pricing options I can set. Is it possible to set both the Regular Price & Price at the same time? Would that let the prices be added automatically when the post is created and updated automatically when it’s edited? Regards |
October 29, 2013 at 4:56 pm 9563 | |
pasturesmoo | Meh, here’s a link to the image… https://www.dropbox.com/s/kfkdu2jepvuyxa2/Screen%20Shot%202013-10-29%20at%2010.40.42.png |
October 29, 2013 at 5:32 pm 9564 | |
Tareq Hasan | Paste this code snippet to your themes [php] update_post_meta( $post_id, ‘_regular_price’, $price ); add_action( ‘wpuf_add_post_after_insert’, ‘wpufe_update_post_price’ ); BTW, are you using any plugin for setting prices in specific country? |
October 29, 2013 at 5:37 pm 9567 | |
pasturesmoo | Thanks I’ll try that. Yes I am using WooCommerce Currency Switcher, by Aelia. |
October 29, 2013 at 7:41 pm 9576 | |
pasturesmoo | The code snippet did add the price and regular price but I still had to go into the wp-admin and re-publish the changes for them to take effect. To confirm in the form I do have the edit settings configured to ‘Set Post Status to: Published’. Anything else I might be able to try? Thanks for your time on this. |
October 29, 2013 at 8:11 pm 9578 | |
pasturesmoo | Actually, it’s doing something weird now. The custom field in the wp-admin product view for price (which uses _price) is being populated with the _sale_price after I’ve re-published it. |
October 29, 2013 at 11:26 pm 9585 | |
Tareq Hasan | If you want to use |
January 11, 2014 at 6:19 am 14306 | |
TheBigFish | Hi Guys, I was wondering if you have figured this issue out or have any updates on it at all. I was dealing with the exact the same issue as pasturesmoo above with other form frontend editor. What happens is this : I create 2 fields in my form. 1 field is for the regular price and I give it a meta _regular_price and the second filed is for Sale Price with the meta _sale_price I am creating regular price and sale price because I am willing to display the sale / discount on my product. What happens after I submit the form is that both values will get correctly input in the edit post / product in admin, so I can see both values there taken from the form, however when I go to preview the product page, these values just do not display in the output. Only after I update the edit post / product page from the admin ( without doing any changes at all ) both values will now display on the output. The other frontend form editor was partly solving the issue for me by doing the following : I would create another HIDDEN field and give it a meta _price. I would then hook this field to calculate the default values from the Regular Price input. And voila, I would achieve my regular price now being displayed on the product detail page automatically, straight after submitting the form. That means that if I create another hidden field, give it another _price meta and set it to calculate the default values from the Sale Price output, I would achieve both Regular and Sale Price to automatically display on the product preview page. The bad thing here is that the other form editor doesn’t allow me to have 2 _price metakeys. I’m quite interested in WPUF, but this feature is essential for the frontend product posting. Any Ideas ?? Does WPUF work this way ? |
May 13, 2014 at 12:11 pm 20379 | |
bigtom | I am had this same issue and the supplied code works fine. |
May 14, 2014 at 6:58 am 20416 | |
bigtom | I take it back. with the supplied code the regular price works, but the sale price will not show unless I go to the product in admin and update without making any changes. |