This topic contains 14 reply and 4 voices, and was last updated by bigtom 5 years, 5 months ago
Viewing 14 Posts - 1 through 14 (of 14 total)
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 Tareq Hasan

The right meta key should be _price. _regular_price and _sale_price is only used when you are giving a discount on a product.

October 27, 2013 at 2:16 pm 9480
pasturesmoo 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 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 _price meta key. Can you try using that?

October 27, 2013 at 10:16 pm 9485
pasturesmoo pasturesmoo

Yeah I’ve tried _price on its own but nothing gets passed to the woocommerce product. The only ones that do pass into the product are _regular_price and _sale_price.

_regular_price and _sale_price only appear in the live published product if I manually go in an open it then publish it from wp-admin. The values are there ready but not shown in the table view of the products until I’ve republished them if that’s any help with figuring it out. If they didn’t need the manual publishing I’d be golden! It’s more of an issue with editing products really as we review them when they’re created anyway, but I guess it’s the same issue.


October 29, 2013 at 4:55 pm 9562
pasturesmoo pasturesmoo

When creating a new product directly in the admin here’s the pricing options I can set.

Woocommerce Product Defaults

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?


October 29, 2013 at 4:56 pm 9563
pasturesmoo pasturesmoo

Meh, here’s a link to the image…

October 29, 2013 at 5:32 pm 9564
Tareq Hasan Tareq Hasan

Paste this code snippet to your themes functions.php, use _price in your form and this code will also copy that price to _regular_price field.

function wpufe_update_post_price( $post_id ) {
$price = get_post_meta( $post_id, ‘_price’, true );

update_post_meta( $post_id, ‘_regular_price’, $price );

add_action( ‘wpuf_add_post_after_insert’, ‘wpufe_update_post_price’ );
add_action( ‘wpuf_edit_post_after_update’, ‘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 pasturesmoo

Thanks I’ll try that.

Yes I am using WooCommerce Currency Switcher, by Aelia.

October 29, 2013 at 7:41 pm 9576
pasturesmoo 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 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 Tareq Hasan

If you want to use _sale_price, change codes _regular_price to this. And also add a hidden field with meta key _visibility and set the value to visible.

January 11, 2014 at 6:19 am 14306
TheBigFish 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 bigtom

I am had this same issue and the supplied code works fine.

May 14, 2014 at 6:58 am 20416
bigtom 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.

Viewing 14 Posts - 1 through 14 (of 14 total)